Skip to content

Commit

Permalink
update outgoing.headers.host incase the destination does proxying
Browse files Browse the repository at this point in the history
  • Loading branch information
dominictarr committed Nov 11, 2011
1 parent f004788 commit 65b7872
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/node-http-proxy/http-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
outgoing.method = req.method;
outgoing.path = req.url;
outgoing.headers = req.headers;

outgoing.headers.host = this.target.host + (this.target.port == 80 ? '' : ':' + this.target.port)

This comment has been minimized.

Copy link
@fjakobs

fjakobs Nov 14, 2011

Contributor

This is actually breaking my code sine I expect the original host in there. Why is it necessary?

Is there another way to get to the original hostname? I don't see it in the 'x-forwarded' headers either.

This comment has been minimized.

Copy link
@indexzero

This comment has been minimized.

Copy link
@fjakobs

fjakobs Nov 14, 2011

Contributor

an x-forwarded-host would to the trick for me

//
// Open new HTTP request to internal resource with will act
// as a reverse proxy pass
Expand Down

3 comments on commit 65b7872

@dominictarr
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, this needs to be configurable.

@fjakobs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agreee. I have reverted it in my branch but that's not a long term solution

@coderarity
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is totally necessary - especially if you're proxying to another proxy that uses the host header! But it should be optional.

Please sign in to comment.