File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
components/http_foundation Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -17,19 +17,20 @@ the actual host may be stored in an ``X-Forwarded-Host`` header.
1717
1818Since HTTP headers can be spoofed, Symfony does *not * trust these proxy
1919headers by default. If you are behind a proxy, you should manually whitelist
20- your proxy.
21-
22- .. versionadded :: 2.3
23- CIDR notation support was introduced in Symfony 2.3, so you can whitelist whole
24- subnets (e.g. ``10.0.0.0/8 ``, ``fc00::/7 ``).
20+ your proxy as follows:
2521
2622.. code-block :: php
2723
2824 use Symfony\Component\HttpFoundation\Request;
2925
30- // only trust proxy headers coming from this IP addresses
26+ // put this code as early as possible in your application (e.g. in your
27+ // front controller) to only trust proxy headers coming from these IP addresses
3128 Request::setTrustedProxies(array('192.0.0.1', '10.0.0.0/8'));
3229
30+ .. versionadded :: 2.3
31+ CIDR notation support was introduced in Symfony 2.3, so you can whitelist whole
32+ subnets (e.g. ``10.0.0.0/8 ``, ``fc00::/7 ``).
33+
3334You should also make sure that your proxy filters unauthorized use of these
3435headers, e.g. if a proxy natively uses the ``X-Forwarded-For `` header, it
3536should not allow clients to send ``Forwarded `` headers to Symfony.
You can’t perform that action at this time.
0 commit comments