Skip to content

x-forwarded-proto is set as httpshttps #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ryanstevens opened this issue May 22, 2012 · 7 comments
Closed

x-forwarded-proto is set as httpshttps #250

ryanstevens opened this issue May 22, 2012 · 7 comments

Comments

@ryanstevens
Copy link
Contributor

When receiving proxied traffic from http-proxy the x-forwarded-proto is set as httpshttps.

This line https://github.com/nodejitsu/node-http-proxy/blob/master/lib/node-http-proxy/http-proxy.js#L151

which is currently
var protoToAppend = "," + req.connection.pair ? 'https' : 'http';

needs to be changed to
var protoToAppend = "," + (req.connection.pair ? 'https' : 'http');

With this change, x-forwarded-proto should be set to https,http

@jfhbrook
Copy link
Contributor

@ryanstevens Wanna PR us this change? I'll pull it. :D

@ryanstevens
Copy link
Contributor Author

#251

maleck13 pushed a commit to maleck13/node-http-proxy that referenced this issue Nov 8, 2013
The ternary was evaluating truthy for "," + req.connection.pair which is always true because its always a non empty string.  Wrapped actual condition to properly concatenate the product of the ternary.  let me know if you prefer the style   (req.connection.pair ? 'https' : 'http')

http-party#250
@grabbou
Copy link

grabbou commented Dec 16, 2014

Actually because of that, the code under FAQ "How to force SSL" is not working and causes infinity loop as req.get('X-Forwarded-Proto') !== 'https' always returns false (because it's http,https).

@jcrugzz
Copy link
Contributor

jcrugzz commented Dec 16, 2014

@grabbou make sure you are using the 1.x.x version of http-proxy

@grabbou
Copy link

grabbou commented Dec 17, 2014

@jcrugzz thanks for the response, how can I check/change that on nodejitsu? Command line / packages.json settings?

For now I only have node engine specified. Actually, I think that forcing SSL's should be done by default if one specified SSL certificates in Nodejitsu dashboard (as it's the only reasonable approach to be honest)

@jcrugzz
Copy link
Contributor

jcrugzz commented Dec 17, 2014

@grabbou if this is about the nodejitsu product please open a support ticket, this is the wrong context for this conversation.

@grabbou
Copy link

grabbou commented Dec 19, 2014

ok, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants