Skip to content

Commit c764769

Browse files
committed
minor #7382 Added a minor help note about Request::setTrustedProxies (javiereguiluz)
This PR was squashed before being merged into the 2.7 branch (closes #7382). Discussion ---------- Added a minor help note about Request::setTrustedProxies This fixes #6198. Commits ------- 48f2c3d Added a minor help note about Request::setTrustedProxies
2 parents 385fe5d + 48f2c3d commit c764769

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

components/http_foundation/trusting_proxies.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,20 @@ the actual host may be stored in an ``X-Forwarded-Host`` header.
1717

1818
Since HTTP headers can be spoofed, Symfony does *not* trust these proxy
1919
headers 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+
3334
You should also make sure that your proxy filters unauthorized use of these
3435
headers, e.g. if a proxy natively uses the ``X-Forwarded-For`` header, it
3536
should not allow clients to send ``Forwarded`` headers to Symfony.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy