core-bundle/src/Security/Logout/LogoutSuccessHandler.php
public function onLogoutSuccess(Request $request): Response
    {
        if ($this->scopeMatcher->isBackendRequest($request)) {
            return $this->createRedirectResponse($request, 'contao_backend_login');
        }

        if ($targetUrl = $request->query->get('redirect')) {
            return $this->createRedirectResponse($request, $targetUrl);
        }

        if ($targetUrl = $request->headers->get('Referer')) {
            return $this->createRedirectResponse($request, $targetUrl);
        }

        return $this->clearJwtToken($request, parent::onLogoutSuccess($request));
    }
public function onLogoutSuccess(Request $request): Response
    {
        if ($this->scopeMatcher->isBackendRequest($request)) {
            return $this->createRedirectResponse($request, 'contao_backend_login');
        }

        if ($targetUrl = $request->query->get('redirect')) {
            return $this->createRedirectResponse($request, $targetUrl);
        }

        if ($targetUrl = $request->headers->get('Referer')) {
            return $this->createRedirectResponse($request, $targetUrl);
        }

        return $this->clearJwtToken($request, parent::onLogoutSuccess($request));
    }
{@inheritdoc}