Issue Bug Under Review Stale

#109750RedirectLoginErrorHandler won't respect proper target UIDs SiteConfiguration

Moritz Ngo 05/04/26, 09:12 updated 09/11/26, 21:46

Description

TYPO3 CMS v13 introduced TYPO3\CMS\Core\Error\PageErrorHandler\RedirectLoginErrorHandler (https://forge.typo3.org/issues/101252)
But when having multiple SiteConfigurations, the resulting URL for the RedirectResponse generated by the handleLoginRedirect() method will be generated with the wrong hostname / SiteConfiguration.

Imagine having multiple site configurations:

[1] Homepage (project.ddev.site)
    [2] Page 1
        [3] Page 1.1
        [4] Page 1.2
    [5] Page 2
        [6] Page 2.1
        [7] Page 2.2
        [8] Page 2.3
    [9] Page 3
[10] Centralized Login (login.ddev.site)
    [11] Dashboard (available after login)
    [12] Login
[13] Another Site (another.ddev.site)
    [14] Publicly accessible Page 1
    [15] Restricted Page 2
    [16] Restricted Page 3

Here’s the relevant SiteConfiguration (effective for all SiteConfigurations):

errorHandling:
    -
        errorCode: 403
        errorHandler: PHP
        errorPhpClassFQCN: 'TYPO3\CMS\Core\Error\PageErrorHandler\RedirectLoginErrorHandler'
        loginRedirectTarget: 't3://page?uid=12'
        loginRedirectParameter: 'redirect_url'

Now when trying to access [11] Dashboard (available after login) without a valid logged in frontend user session, RedirectLoginErrorHandler::handleLoginRedirect() will generate the proper URL to [12] Login (https://login.ddev.site/login).
But when trying to access [15] Restricted Page 2 without a valid logged in frontend user session, RedirectLoginErrorHandler::handleLoginRedirect() will wrongly generate the URL to [12] Login by using the hostname of the current request, instead of the hostname of the login page, resulting in https://another.ddev.site/login instead of https://login.ddev.site/login.

Reviews 1

History 05