Bug #103395
closedRedirects with domains without site configuration not possible anymore
100%
Description
I upgraded a larger site from 10 to 12 LTS and some redirects don't work anymore.
Setup:
- Main Domain: customer.tld
- Domain other-domain.tld points to the same directory as main domain
- Redirect other-domain.tld/foo to a valid page customer/tld.
The error No TypoScript record found
is thrown triggered from
\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::getFromCache \TYPO3\CMS\Redirects\Service\RedirectService::bootFrontendController
which is valid as there is no site for other-domain
and I also don't want to provide one
my working solution/patch is
--- a/Classes/Service/RedirectService.php +++ b/Classes/Service/RedirectService.php @@ -395,6 +395,9 @@ new PageArguments($site->getRootPageId(), '0', []), $originalRequest->getAttribute('frontend.user') ); + if ($originalRequest->getAttribute('site') instanceof NullSite) { + $originalRequest = $originalRequest->withAttribute('site', GeneralUtility::makeInstance(SiteFinder::class)->getSiteByRootPageId(1)); + } $controller->determineId($originalRequest); $controller->calculateLinkVars($queryParams); $newRequest = $controller->getFromCache($originalRequest);
Updated by Gerrit Code Review 8 months ago
- Status changed from Accepted to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83469
Updated by Stefan Bürk 8 months ago
- Status changed from Under Review to Needs Feedback
- Assignee set to Stefan Bürk
Pushed a change adding some test. However, the incoming domain and the resolved
page seems not to be the issue. In the test, I could only provoke the error
No TypoScript record found
if the target page of the redirect has a site but no TypoScript record set for
that site (rendering that side not visible in the frontend).
Do you have more information on your setup ? See the change and the added testcase
for the redirect record I created.
Can you give more information about the "target page siteconfig and TypoScript record" ?
Note: The change applies without conflict on v12 - so I did not created a backport on gerrit for now.
Updated by Stefan Bürk 8 months ago
Additional Information:
Georg answered in slack - he is using b13/bolt (and not having sys_template record on sites).
So, that's the point to investigate.
Updated by Georg Ringer 8 months ago
nevertheless IMO the correct solution is to check if a site can be found by the original request because if no site is available, the TSFE can never be fetched properly - IMO the site should be then be retrieved from the target site
Updated by Gerrit Code Review 8 months ago
- Status changed from Needs Feedback to Under Review
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83469
Updated by Gerrit Code Review 8 months ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83469
Updated by Stefan Bürk 8 months ago
NOTE: This is already fixed in TYPO3 main / v13. I worked on adding tests,
which are "green" on main but fails for v12.
This is related to changes with the TypoScript factory and set changes.
That means, the fix os only needed for TYPO3 v12.
I will extract the tests to a pre-patch now so we have them in place. Than
we can work on a fix for this.
Updated by Stefan Bürk 8 months ago
- Related to Task #103555: Add `RedirectService` tests as preparation for a bugfix added
Updated by Stefan Bürk 8 months ago
Abandoned https://review.typo3.org/c/Packages/TYPO3.CMS/+/83469 for now.
#103555 adds tests to main and 12.4, which reveales that this issue
has been fixed for main already with other changes.
That means, we need to fix this only in TYPO3 v12 after the tests has
been added (merged).
Updated by Gerrit Code Review 8 months ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83701
Updated by Gerrit Code Review 8 months ago
Patch set 2 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83701
Updated by Stefan Bürk 8 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 1a1ff716ba02a1301131645d894c0192d264f4fe.