Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 15748c7

Browse files
committed
Log potential redirect loops caused by forced HTTPS
If the developer forgets/fails to set "trusted_proxies" properly, forcing the https channel can cause infinite redirect loops. This change will hopefully help them identify the problem faster. See #27603
1 parent b560883 commit 15748c7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Symfony/Component/Security/Http/Firewall/ChannelListener.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public function handle(GetResponseEvent $event)
4747
if ('https' === $channel && !$request->isSecure()) {
4848
if (null !== $this->logger) {
4949
$this->logger->info('Redirecting to HTTPS.');
50+
if ('https' === $request->headers->get('X-Forwarded-Proto')) {
51+
$this->logger->debug('Possible redirect loop - did you set "trusted_proxies" correctly?');
52+
}
5053
}
5154

5255
$response = $this->authenticationEntryPoint->start($request);

0 commit comments

Comments
 (0)