Skip to content

x-forwarded-proto has wrong value #251

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
wants to merge 1 commit into from
Closed

x-forwarded-proto has wrong value #251

wants to merge 1 commit into from

Conversation

ryanstevens
Copy link
Contributor

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')

#250

… 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')


#250
@jfhbrook
Copy link
Contributor

lgtm, cherry-picked. :D Thanks!

@jfhbrook jfhbrook closed this May 22, 2012
@indexzero
Copy link
Member

@ryanstevens nice catch.

@rampr
Copy link
Contributor

rampr commented Jun 16, 2012

Seems like I still have the issue.

Only changing it to,
var protoToAppend = "," + (req.connection.pair ? 'https' : 'http');

fixes it.

Looks like + has a higher precedence compared to the ternary operator
https://developer.mozilla.org/en/JavaScript/Reference/Operators/Operator_Precedence

@jfhbrook
Copy link
Contributor

@rampr Interesting. If you'd like to make another pull request I will gladly accept. :)

@rampr
Copy link
Contributor

rampr commented Jun 19, 2012

Sure. Here you go - #266

@jfhbrook
Copy link
Contributor

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

Successfully merging this pull request may close these issues.

4 participants