You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #21830 [HttpFoundation] Add $trustedHeaderSet arg to Request::setTrustedProxies() - deprecate not setting it (nicolas-grekas)
This PR was merged into the 3
8000
.3-dev branch.
Discussion
----------
[HttpFoundation] Add $trustedHeaderSet arg to Request::setTrustedProxies() - deprecate not setting it
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | no tests yet
| Fixed tickets | -
| License | MIT
| Doc PR | -
Follow up of #18688
PR adds a second `$trustedHeaderSet` argument to `Request::setTrustedProxies()`, can be either `Request::HEADER_FORWARDED` or `Request::HEADER_X_FORWARDED_ALL` to set which header to trust from your proxies - the idea being that without this info, one will get some `ConflictingHeadersException`, but those may be lost in the logs.
Commits
-------
d3c9604 [HttpFoundation] Add $trustedHeaderSet arg to Request::setTrustedProxies() - deprecate not setting it
Copy file name to clipboardExpand all lines: UPGRADE-3.3.md
+16-3Lines changed: 16 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,6 +126,9 @@ FrameworkBundle
126
126
* The `cache:clear` command should always be called with the `--no-warmup` option.
127
127
Warmup should be done via the `cache:warmup` command.
128
128
129
+
* The "framework.trusted_proxies" configuration option and the corresponding "kernel.trusted_proxies" parameter have been deprecated and will be removed in 4.0. Use the Request::setTrustedProxies() method in your front controller instead.
130
+
131
+
129
132
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass` has been deprecated. Use `Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass` instead.
130
133
131
134
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\SerializerPass` class has been
@@ -175,14 +178,24 @@ FrameworkBundle
175
178
class has been deprecated and will be removed in 4.0. Use the
176
179
`Symfony\Component\Routing\DependencyInjection\RoutingResolverPass` class instead.
177
180
178
-
* The `server:run`, `server:start`, `server:stop` and
179
-
`server:status` console commands have been moved to a dedicated bundle.
180
-
Require `symfony/web-server-bundle` in your composer.json and register
181
+
* The `server:run`, `server:start`, `server:stop` and
182
+
`server:status` console commands have been moved to a dedicated bundle.
183
+
Require `symfony/web-server-bundle` in your composer.json and register
181
184
`Symfony\Bundle\WebServerBundle\WebServerBundle` in your AppKernel to use them.
182
185
183
186
* The `Symfony\Bundle\FrameworkBundle\Translation\Translator` constructor now takes the
184
187
default locale as 3rd argument. Not passing it will trigger an error in 4.0.
185
188
189
+
HttpFoundation
190
+
--------------
191
+
192
+
* The `Request::setTrustedProxies()` method takes a new `$trustedHeaderSet` argument - not setting it is deprecated.
193
+
Set it to `Request::HEADER_FORWARDED` if your reverse-proxy uses the RFC7239 `Forwarded` header,
194
+
or to `Request::HEADER_X_FORWARDED_ALL` if it is using `X-Forwarded-*` headers instead.
195
+
196
+
* The `Request::setTrustedHeaderName()` and `Request::getTrustedHeaderName()` methods are deprecated,
197
+
use the RFC7239 `Forwarded` header, or the `X-Forwarded-*` headers instead.
Copy file name to clipboardExpand all lines: UPGRADE-4.0.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -190,6 +190,8 @@ FrameworkBundle
190
190
* The `cache:clear` command does not warmup the cache anymore. Warmup should
191
191
be done via the `cache:warmup` command.
192
192
193
+
* The "framework.trusted_proxies" configuration option and the corresponding "kernel.trusted_proxies" parameter have been removed. Use the `Request::setTrustedProxies()` method in your front controller instead.
194
+
193
195
* Support for absolute template paths has been removed.
194
196
195
197
* The following form types registered as services have been removed; use their
@@ -280,6 +282,15 @@ FrameworkBundle
280
282
HttpFoundation
281
283
---------------
282
284
285
+
HttpFoundation
286
+
--------------
287
+
288
+
* The `Request::setTrustedProxies()` method takes a new `$trustedHeaderSet` argument.
289
+
Set it to `Request::HEADER_FORWARDED` if your reverse-proxy uses the RFC7239 `Forwarded` header,
290
+
or to `Request::HEADER_X_FORWARDED_ALL` if it is using `X-Forwarded-*` headers instead.
291
+
292
+
* The `Request::setTrustedHeaderName()` and `Request::getTrustedHeaderName()` methods have been removed.
293
+
283
294
* Extending the following methods of `Response`
284
295
is no longer possible (these methods are now `final`):
Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Monolog/composer.json
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,9 @@
25
25
"symfony/event-dispatcher": "~2.8|~3.0",
26
26
"symfony/var-dumper": "~3.3"
27
27
},
28
+
"conflict": {
29
+
"symfony/http-foundation": "<3.3"
30
+
},
28
31
"suggest": {
29
32
"symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.",
30
33
"symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings. You need version ~2.3 of the console for it.",
@trigger_error('The "framework.trusted_proxies" configuration key is deprecated since version 3.3 and will be removed in 4.0. Use the Request::setTrustedProxies() method in your front controller instead.', E_USER_DEPRECATED);
if ($trustedProxies = $this->container->getParameter('kernel.trusted_proxies')) {
63
-
Request::setTrustedProxies($trustedProxies);
63
+
@trigger_error('The "kernel.trusted_proxies" parameter is deprecated since version 3.3 and will be removed in 4.0. Use the Request::setTrustedProxies() method in your front controller instead.', E_USER_DEPRECATED);
0 commit comments