From b0d91b0db3576a2dc7b4ebac518724d8063c5de1 Mon Sep 17 00:00:00 2001 From: winter Sparkles Date: Sun, 9 Aug 2026 16:17:29 +0100 Subject: fix auth-request so it works better --- routes/integration/auth-request.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'routes/integration') diff --git a/routes/integration/auth-request.php b/routes/integration/auth-request.php index 51b54d8..21c5d11 100644 --- a/routes/integration/auth-request.php +++ b/routes/integration/auth-request.php @@ -3,6 +3,7 @@ // nginx (and others?) auth_request style endpoint // returns 200 for allowed requests // otherwise, returns 401 and sends the login page url as a header +// if request header X-Original-Uri is given, it puts it as the post-login redir function addHeader(array $config, string $baseName, string $value): void { $prefix = $config['integration']['header-prefix']; @@ -23,8 +24,9 @@ function GET(array $config) { } http_response_code(401); - addHeader( - $config, 'Location', - 'https://' . $config['site']['primary-domain'] . '/login' - ); + $login = 'https://' . $config['site']['primary-domain'] . '/login'; + if (isset($_SERVER['HTTP_X_ORIGINAL_URI'])) { + $login .= '?next=' . urlencode($_SERVER['HTTP_X_ORIGINAL_URI']); + } + addHeader($config, 'Location', $login); } -- cgit v1.3