-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[HttpKernel] Make sure HttpCache is a trusted proxy #11937
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
👍 |
This is not really a bug fix though. |
@@ -462,6 +462,12 @@ protected function forward(Request $request, $catch = false, Response $entry = n | |||
// is always called from the same process as the backend. | |||
$request->server->set('REMOTE_ADDR', '127.0.0.1'); | |||
|
|||
// make sure HttpCache is a trusted proxy | |||
if (!in_array('127.0.0.1', $trustedProxies = Request::getTrustedProxies())) { |
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.
What about adding 127.0.0.1 directly in the list of trusted proxies in the Request class?
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.
@fabpot it should be trusted only when the HttpCache is used, not always. Otherwise it will trust the forwarded headers all the time
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.
@stof this seems to be necessary also when using a subrequest (at least in my experience).
👍 |
Thank you @thewilkybarkid. |
…lkybarkid) This PR was merged into the 2.3 branch. Discussion ---------- [HttpKernel] Make sure HttpCache is a trusted proxy | Q | A | ------------- | --- | Bug fix? | yes (of sorts) | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #9292 | License | MIT | Doc PR | symfony/symfony-docs#4239 Fixes #9292 by adding `127.0.0.1` as a trusted proxy when using `HttpCache` (assuming it hasn't been already). Commits ------- ca65362 Make sure HttpCache is a trusted proxy
…ilkybarkid) This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #4239). Discussion ---------- Remove redundant references to trusting HttpCache | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.3+ | Fixed tickets | Removes references to making `HttpCache` a trusted proxy as symfony/symfony#11937 would cause it to be handled automatically. Alternatively it could be reworded, but I'm not sure it's useful to say that this happens (since it was a bit odd to have to configure Symfony to let one part of the code base trust another). Commits ------- 8f157dc Remove redundant references to trusting HttpCache
Thanks @thewilkybarkid. Unfortunately I didn't take the time to do it myself. |
Fixes #9292 by adding
127.0.0.1
as a trusted proxy when usingHttpCache
(assuming it hasn't been already).