@@ -33,6 +33,8 @@ and what headers your reverse proxy uses to send information:
33
33
# ...
34
34
# the IP address (or range) of your proxy
35
35
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'
36
38
# trust *all* "X-Forwarded-*" headers
37
39
trusted_headers : ['x-forwarded-for', 'x-forwarded-host', 'x-forwarded-proto', 'x-forwarded-port', 'x-forwarded-prefix']
38
40
# or, if your proxy instead uses the "Forwarded" header
@@ -53,6 +55,8 @@ and what headers your reverse proxy uses to send information:
53
55
<framework : config >
54
56
<!-- the IP address (or range) of your proxy -->
55
57
<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 >
56
60
57
61
<!-- trust *all* "X-Forwarded-*" headers -->
58
62
<framework : trusted-header >x-forwarded-for</framework : trusted-header >
@@ -75,13 +79,20 @@ and what headers your reverse proxy uses to send information:
75
79
$framework
76
80
// the IP address (or range) of your proxy
77
81
->trustedProxies('192.0.0.1,10.0.0.0/8')
82
+ // shortcut for private IP address ranges of your proxy
83
+ ->trustedProxies('private_ranges')
78
84
// trust *all* "X-Forwarded-*" headers (the ! prefix means to not trust those headers)
79
85
->trustedHeaders(['x-forwarded-for', 'x-forwarded-host', 'x-forwarded-proto', 'x-forwarded-port', 'x-forwarded-prefix'])
80
86
// or, if your proxy instead uses the "Forwarded" header
81
87
->trustedHeaders(['forwarded'])
82
88
;
83
89
};
84
90
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
+
85
96
.. caution ::
86
97
87
98
Enabling the ``Request::HEADER_X_FORWARDED_HOST `` option exposes the
0 commit comments