@@ -25,40 +25,19 @@ and which reverse proxy IP addresses will be doing this type of thing:
2525
2626.. configuration-block ::
2727
28- .. code-block :: yaml
29-
30- # app/config/config.yml
31- # ...
32- framework :
33- trusted_proxies : [192.0.0.1, 10.0.0.0/8]
34-
35- .. code-block :: xml
36-
37- <!-- app/config/config.xml -->
38- <?xml version =" 1.0" encoding =" UTF-8" ?>
39- <container xmlns =" http://symfony.com/schema/dic/services"
40- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
41- xmlns : framework =" http://symfony.com/schema/dic/symfony"
42- xsi : schemaLocation =" http://symfony.com/schema/dic/services
43- http://symfony.com/schema/dic/services/services-1.0.xsd
44- http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
28+ .. code-block :: diff
4529
46- <framework : config trusted-proxies =" 192.0.0.1, 10.0.0.0/8" >
47- <!-- ... -->
48- </framework : config >
49- </container >
30+ // web/app.php
5031
51- .. code-block :: php
32+ // ...
33+ $request = Request::createFromGlobals();
34+ + Request::setTrustedProxies(['127.0.0.1', '10.0.0.0/8']);
5235
53- // app/config/config.php
54- $container->loadFromExtension('framework', array(
55- 'trusted_proxies' => array('192.0.0.1', '10.0.0.0/8'),
56- ));
36+ // ...
5737
5838In this example, you're saying that your reverse proxy (or proxies) has
5939the IP address ``192.0.0.1 `` or matches the range of IP addresses that use
60- the CIDR notation ``10.0.0.0/8 ``. For more details, see the
61- :ref: `framework.trusted_proxies <reference-framework-trusted-proxies >` option.
40+ the CIDR notation ``10.0.0.0/8 ``.
6241
6342You are also saying that you trust that the proxy does not send conflicting
6443headers, e.g. sending both ``X-Forwarded-For `` and ``Forwarded `` in the same
0 commit comments