Skip to content

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

Closed
zionts wants to merge 1 commit into
expressjs:masterfrom
zionts:master
Closed

If XFH header has multiple values while proxying, use oldest#3625
zionts wants to merge 1 commit into
expressjs:masterfrom
zionts:master

Conversation

@zionts

Copy link
Copy Markdown

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

wesleytodd commented Apr 17, 2018

Copy link
Copy Markdown
Member

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

dougwilson commented Apr 17, 2018

Copy link
Copy Markdown
Contributor

This is just a duplicate of #3495 anyway.

@dougwilson

Copy link
Copy Markdown
Contributor

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

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@zionts@wesleytodd@dougwilson