-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Examine X-Forwarded-Host
for additional port information
#135
Examine X-Forwarded-Host
for additional port information
#135
Conversation
Signed-off-by: Maximilian Bösing <[email protected]>
Signed-off-by: Maximilian Bösing <[email protected]>
TBH: Not even sure if it makes any sense to pass a port via I guess most if not any webserver (besides |
Signed-off-by: Maximilian Bösing <[email protected]>
…is only ignored when `X-Forwarded-Port` is available Signed-off-by: Maximilian Bösing <[email protected]>
Signed-off-by: Maximilian Bösing <[email protected]>
396866d
to
441cd05
Compare
This also requires `Uri` to be `psalm-immutable`. Signed-off-by: Maximilian Bösing <[email protected]>
Signed-off-by: Maximilian Bösing <[email protected]>
Signed-off-by: Maximilian Bösing <[email protected]>
…uppressed Signed-off-by: Maximilian Bösing <[email protected]>
…aracters Signed-off-by: Maximilian Bösing <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks... pretty sane. My one concern is how this plays with our fixes for [LP-2022-02](https://getlaminas.org/security/advisory/LP-2022-02}, though what it looks like in here is it is properly considering X-Forwarded-Port as the "source of truth" if both that and X-Forwarded-Host are present.
@weierophinney From my understanding, the priority is implicitly decided based on the ordering of the headers within the The current version of the PR looks reasonable to me as well, the port is taken from the xfh header (if available), if both xfh and xfp match, it does the right thing by definition and if they differ, then the user is able to select the priority based on the ordering in the list. (If xfh and xfp differ, the reverse proxy is broken beyond repair, so … who cares). Please just give me the time to also check the Traefik source code / behavior (see the existing comment thread with boesing), so that the decision can be backed up with some hard evidence in case someone complains in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proposed behavior looks correct to me. There should likely be a follow-up that makes ->withHost()
more strict to prevent it from accepting garbage (such as colons or whitespace). See also this comment in a previous PR of mine: #97 (comment)
Signed-off-by: Maximilian Bösing <[email protected]>
X-Forwarded-Host
X-Forwarded-Host
for additional port information
Description
Fixes #111