Skip to content

[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

Merged
merged 1 commit into from
Mar 22, 2017

Conversation

nicolas-grekas
Copy link
Member

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

@@ -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());
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I see 👍

@fabpot
Copy link
Member

fabpot commented Mar 22, 2017

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 04caacb into symfony:2.8 Mar 22, 2017
fabpot added a commit that referenced this pull request Mar 22, 2017
…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
@nicolas-grekas nicolas-grekas deleted the req-forwarded branch March 22, 2017 20:30
This was referenced Apr 5, 2017
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.

4 participants