Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c764769

Browse filesBrowse 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
Copy full SHA for c764769

File tree

1 file changed

+7
-6
lines changed
Filter options

1 file changed

+7
-6
lines changed

‎components/http_foundation/trusting_proxies.rst

Copy file name to clipboardExpand all lines: components/http_foundation/trusting_proxies.rst
+7-6Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.