Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 613e5c4

Browse files
committed
minor #7619 Making it more clear where Request::setTrustedProxies should go (weaverryan)
This PR was merged into the 2.7 branch. Discussion ---------- Making it more clear where Request::setTrustedProxies should go ... And trying out the `diff` format! I know we lose the `php` formatting, but in this case, it seems superior. Commits ------- 869e5d2 Making it more clear where to add the Request::setTrustedProxies line
2 parents 814d8c4 + 869e5d2 commit 613e5c4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

request/load_balancer_reverse_proxy.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,16 @@ In this case, you'll need to - *very carefully* - trust *all* proxies.
8282

8383
#. Once you've guaranteed that traffic will only come from your trusted reverse
8484
proxies, configure Symfony to *always* trust incoming request. This is
85-
done inside of your front controller::
85+
done inside of your front controller:
86+
87+
.. code-block:: diff
8688
8789
// web/app.php
8890
8991
// ...
90-
Request::setTrustedProxies(array('127.0.0.1', $request->server->get('REMOTE_ADDR')));
92+
$request = Request::createFromGlobals();
93+
+ Request::setTrustedProxies(array('127.0.0.1', $request->server->get('REMOTE_ADDR')));
9194
92-
$response = $kernel->handle($request);
9395
// ...
9496
9597
#. Ensure that the trusted_proxies setting in your ``app/config/config.yml``

0 commit comments

Comments
 (0)