Project

General

Profile

Actions

Bug #103395

closed

Redirects with domains without site configuration not possible anymore

Added by Georg Ringer about 1 month ago. Updated 20 days ago.

Status:
Resolved
Priority:
Should have
Assignee:
Category:
Redirect Handling
Target version:
-
Start date:
2024-03-14
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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);


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #103555: Add `RedirectService` tests as preparation for a bugfixResolvedStefan Bürk2024-04-07

Actions
Actions #1

Updated by Gerrit Code Review about 1 month 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

Actions #2

Updated by Stefan Bürk about 1 month ago

  • Status changed from Under Review to Needs Feedback
  • Assignee set to Stefan Bürk

@Georg Ringer

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.

Actions #3

Updated by Stefan Bürk about 1 month 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.

Actions #4

Updated by Georg Ringer about 1 month 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

Actions #5

Updated by Gerrit Code Review 24 days 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

Actions #6

Updated by Gerrit Code Review 21 days 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

Actions #7

Updated by Stefan Bürk 21 days 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.

Actions #8

Updated by Stefan Bürk 21 days ago

  • Related to Task #103555: Add `RedirectService` tests as preparation for a bugfix added
Actions #9

Updated by Stefan Bürk 21 days 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).

Actions #10

Updated by Gerrit Code Review 20 days 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

Actions #11

Updated by Gerrit Code Review 20 days 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

Actions #12

Updated by Stefan Bürk 20 days ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF