#106757PageErrorHandler: Subrequest should handle redirects
Description
In EXT:core/Classes/Error/PageErrorHandler/PageContentErrorHandler.php with subrequests (experimental since TYPO3 v11, default since TYPO3 v12) there is a check for the resultcode of a subrequest:
if ($subResponse->getStatusCode() >= 300)
We have a case where a redirection-middleware (custom extension) generates redirects if needed and returns
$response = new RedirectResponse($uri, 307);
This can lead to cases where even the error-document can be a redirect. And when the subrequest returns this leads to an exception:
throw new \RuntimeException(sprintf(‘Error handler could not fetch error page “%s”, status code: %s’, $resolvedUrl, $subResponse->getStatusCode()), 1544172839);
Imho also our internal subrequests should support following redirects, maybe with a max-redirect-counter to avoid loops (like Guzzle and browsers also do). Can we maybe handle all redirects (status-codes in the 300-range) internally for subrequests and not throw an exception?
Reviews 1
History 24
-
Stefan Neufeind commented <span data-processor="relativetime" data-value="2025-05-23T12:12:51+00:00" > 05/23/25, 12:12 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 96732 status
NewUnder Review <span data-processor="relativetime" data-value="2026-10-15T16:55:57+00:00" > 10/15/26, 16:55 </span> -
Gerrit Code Review pushed patch set 2 for main to change 96732 <span data-processor="relativetime" data-value="2026-10-30T16:45:36+00:00" > 10/30/26, 16:45 </span>
-
Oliver Bartsch changed Duplicated by #107548 <span data-processor="relativetime" data-value="2026-11-05T07:39:03+00:00" > 11/05/26, 07:39 </span>
We might need to parse the “location” provided by a RedirectResponse since it can contain a URL. handlePageError() currently handles only internal requests (to a certain pid) and otherwise sends external Requests (does not use a subrequest). That’s generally okay – but if the URL can be resolved to a pid (is an internal page) it should be a candidate for a subrequest. Maybe we need RedirectResponse to be able to be an internal link (like with a t3://-url) instead of creating an uri first? Otherwise we create an uri to redirect to a certain page just to parse it again afterwards and fine which pid it linked to.