@@ -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 to 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