[BUGFIX] URL without base runs into a redirect loop 91/59891/5
authorMarco Kaiser <mks@dotsource.de>
Wed, 6 Mar 2019 20:32:00 +0000 (21:32 +0100)
committerGeorg Ringer <georg.ringer@gmail.com>
Thu, 18 Apr 2019 11:25:11 +0000 (13:25 +0200)
Calling something like bla.example.com/?id=34&type=2
runs in a endless loop.

The change removes the restrictive redirect.

Change-Id: I0457c48640d6b47a0947ed5115a96cf73cc97d81
Resolves: #88032
Releases: master, 9.5
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/59891
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/frontend/Classes/Middleware/SiteBaseRedirectResolver.php
typo3/sysext/frontend/Tests/Unit/Middleware/SiteBaseRedirectResolverTest.php

index 845462e..4dbd04e 100644 (file)
@@ -71,11 +71,6 @@ class SiteBaseRedirectResolver implements MiddlewareInterface
                 $uri = $requestedUri->withPath(rtrim($requestedUri->getPath(), '/'));
                 return new RedirectResponse($uri, 307);
             }
-            // Request was "/fr-FR" but the site is actually called "/fr-FR/", let's do a redirect
-            if ($tail === '' && $language->getBase()->getPath() !== $requestedUri->getPath()) {
-                $uri = $requestedUri->withPath($requestedUri->getPath() . '/');
-                return new RedirectResponse($uri, 307);
-            }
         }
         return $handler->handle($request);
     }
index 4ccbbc5..95f84ff 100644 (file)
@@ -109,13 +109,6 @@ class SiteBaseRedirectResolverTest extends UnitTestCase
                 null,
                 ''
             ],
-            'redirect to first language adding a slash' => [
-                'https://twenty.one/en',
-                'https://twenty.one/en/',
-                $site1,
-                $site1->getLanguageById(0),
-                ''
-            ],
             'redirect to second language removing a slash' => [
                 'https://twenty.one/fr/',
                 'https://twenty.one/fr',