-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] Fix missing handling of for/host/proto info from "Forwarded" header #21849
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
Conversation
40c4d23
to
4c6c13c
Compare
@@ -1662,7 +1662,7 @@ public function testTrustedProxies() | |||
// trusted proxy via setTrustedProxies() | |||
Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2')); | |||
$this->assertEquals('1.1.1.1', $request->getClientIp()); | |||
$this->assertEquals('real.example.com', $request->getHost()); | |||
$this->assertEquals('foo.example.com', $request->getHost()); |
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.
so technically the behaviour is changed here for handling the X_FORWARDED_HOST
header? Does it matter for BC?
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.
I think nobody reported this bug because nobody is doing double reverse proxies (which is what this needs to be hit). But I doubt this will break, since having a mixed "port from edge" + "host from the second proxy" already makes little sense.
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.
Ok I see 👍
4c6c13c
to
04caacb
Compare
Thank you @nicolas-grekas. |
…fo from "Forwarded" header (nicolas-grekas) This PR was merged into the 2.8 branch. Discussion ---------- [HttpFoundation] Fix missing handling of for/host/proto info from "Forwarded" header | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - We're missing handling of for/host/proto info embedded in the `Forwarded` header, as eg in: `Forwarded: for=1.1.1.1:443, host=foo.example.com:1234, proto=https, for=2.2.2.2, host=real.example.com:8080` Commits ------- 04caacb [HttpFoundation] Fix missing handling of for/host/proto info from "Forwarded" header
We're missing handling of for/host/proto info embedded in the
Forwarded
header, as eg in:Forwarded: for=1.1.1.1:443, host=foo.example.com:1234, proto=https, for=2.2.2.2, host=real.example.com:8080