Skip to content
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

If XFH header has multiple values while proxying, use oldest #3625

Closed
wants to merge 1 commit into from

Conversation

zionts
Copy link

@zionts zionts commented Apr 17, 2018

If an express server is sitting behind multiple proxies, it's
conceivable that multiple X-Forwarded-Host headers might get set. In
that case, Express should not crash and instead take the oldest
(left-most) header value to use as the host.

If an express server is sitting behind multiple proxies, it's
    conceivable that multiple X-Forwarded-Host headers might get set. In
    that case, Express should not crash and instead take the oldest
    (left-most) header value to use as the host.
@wesleytodd
Copy link
Member

wesleytodd commented Apr 17, 2018

Headers should always be strings, and express does not have any code for modifying this. So I am confused as to why you are getting an array for this.get('X-Forwarded-Host'). Also, the implementation for this, when set properly for your set of proxy ip addresses, should be correct. Is it possible that something in your code base is causing this?

@dougwilson
Copy link
Contributor

dougwilson commented Apr 17, 2018

This is just a duplicate of #3495 anyway.

@dougwilson
Copy link
Contributor

That PR will land in 4.17 and even has tests for it, which seems like the better one 👍

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

Successfully merging this pull request may close these issues.

3 participants