@@ -25,40 +25,19 @@ and which reverse proxy IP addresses will be doing this type of thing:
25
25
26
26
.. configuration-block ::
27
27
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
45
29
46
- <framework : config trusted-proxies =" 192.0.0.1, 10.0.0.0/8" >
47
- <!-- ... -->
48
- </framework : config >
49
- </container >
30
+ // web/app.php
50
31
51
- .. code-block :: php
32
+ // ...
33
+ $request = Request::createFromGlobals();
34
+ + Request::setTrustedProxies(['127.0.0.1', '10.0.0.0/8']);
52
35
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
+ // ...
57
37
58
38
In this example, you're saying that your reverse proxy (or proxies) has
59
39
the 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 ``.
62
41
63
42
You are also saying that you trust that the proxy does not send conflicting
64
43
headers, e.g. sending both ``X-Forwarded-For `` and ``Forwarded `` in the same
0 commit comments