Skip to content

Commit 11a7362

Browse files
committed
feature #19385 [FrameworkBundle] add a private_ranges shortcut for trusted_proxies (alamirault)
This PR was squashed before being merged into the 7.1 branch. Discussion ---------- [FrameworkBundle] add a private_ranges shortcut for trusted_proxies Fix #19364 Commits ------- 0ac3068 [FrameworkBundle] add a private_ranges shortcut for trusted_proxies
2 parents bc670fe + 0ac3068 commit 11a7362

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

deployment/proxies.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ and what headers your reverse proxy uses to send information:
3333
# ...
3434
# the IP address (or range) of your proxy
3535
trusted_proxies: '192.0.0.1,10.0.0.0/8'
36+
# shortcut for private IP address ranges of your proxy
37+
trusted_proxies: 'private_ranges'
3638
# trust *all* "X-Forwarded-*" headers
3739
trusted_headers: ['x-forwarded-for', 'x-forwarded-host', 'x-forwarded-proto', 'x-forwarded-port', 'x-forwarded-prefix']
3840
# or, if your proxy instead uses the "Forwarded" header
@@ -53,6 +55,8 @@ and what headers your reverse proxy uses to send information:
5355
<framework:config>
5456
<!-- the IP address (or range) of your proxy -->
5557
<framework:trusted-proxies>192.0.0.1,10.0.0.0/8</framework:trusted-proxies>
58+
<!-- shortcut for private IP address ranges of your proxy -->
59+
<framework:trusted-proxies>private_ranges</framework:trusted-proxies>
5660
5761
<!-- trust *all* "X-Forwarded-*" headers -->
5862
<framework:trusted-header>x-forwarded-for</framework:trusted-header>
@@ -75,13 +79,20 @@ and what headers your reverse proxy uses to send information:
7579
$framework
7680
// the IP address (or range) of your proxy
7781
->trustedProxies('192.0.0.1,10.0.0.0/8')
82+
// shortcut for private IP address ranges of your proxy
83+
->trustedProxies('private_ranges')
7884
// trust *all* "X-Forwarded-*" headers (the ! prefix means to not trust those headers)
7985
->trustedHeaders(['x-forwarded-for', 'x-forwarded-host', 'x-forwarded-proto', 'x-forwarded-port', 'x-forwarded-prefix'])
8086
// or, if your proxy instead uses the "Forwarded" header
8187
->trustedHeaders(['forwarded'])
8288
;
8389
};
8490
91+
.. versionadded:: 7.1
92+
93+
``private_ranges`` as a shortcut for private IP address ranges for the
94+
`trusted_proxies` option was introduced in Symfony 7.1.
95+
8596
.. caution::
8697

8798
Enabling the ``Request::HEADER_X_FORWARDED_HOST`` option exposes the

0 commit comments

Comments
 (0)