drewzboto / grunt-connect-proxy

Grunt Connect support for proxying API calls during development
MIT License
423 stars 122 forks source link

Patch for http to https proxy #102

Open sukrit007 opened 9 years ago

sukrit007 commented 9 years ago

Set agent for proxy to address connection refused for proxying request from http to https.

See: https://github.com/nodejitsu/node-http-proxy/blob/caronte/examples/http/proxy-http-to-https.js

It also requires setting of host headers but that can be passed using proxy config.

Purpose of the agent property and PR: Basically I am running into issue where in if I have http frontend with https proxy backend, I get "Connection Refused". FOr reference here is the issue : nodejitsu/node-http-proxy#304

To address this issue, we need to do 2 things:

Pass the host header Pass the agent property

The PR adds the ability to add the agent property to support https proxy to BE host for http front end. In addition it adds the ability to override host header.

io41 commented 9 years ago

Isn't this covered by PR #101 ? (which also as improved default port handling and fixed usage of the proxy api)

ruiaraujo commented 9 years ago

I am not really sure the title for this PR is correct. @sukrit007 What is the goal of that agent property?

sukrit007 commented 9 years ago

@ruiaraujo Looks like there are some conflicts now. I will rebase my changes and squash commits.

Purpose of the agent property and PR: Basically I am running into issue where in if I have http frontend with https proxy backend, I get "Connection Refused". FOr reference here is the issue : https://github.com/nodejitsu/node-http-proxy/issues/304

To address this issue, we need to do 2 things:

I could do first one by passing explicit headers, but could not set the agent property.

sukrit007 commented 9 years ago

@io41 I looked at the PR but did not see agent property. I will rebase my changes and pass the agent property. I need agent property to address http to https proxy (See explanation above)

sukrit007 commented 9 years ago

@ruiaraujo : Ready for review

Changes:

sukrit007 commented 9 years ago

Just wanted to followup on this PR. Do you need anything else wrt same ?

cosmin-dumitrache commented 9 years ago

@ruiaraujo Hi, can you please merge this? I've ran into this issue with my setup as well and this pull request fixed it.

EDIT: Actually, I am seeing an issue. It works when testing with postman, but Chrome and Safari give an error saying the content can not be decoded.

sukrit007 commented 9 years ago

@cosmin-dumitrache working fine on Chrome/Safari. Can you provide exact steps.

Also I will rebase the changes to resolve conflicts. @ruiaraujo: Would you need me to address anything else in this PR ?