diff options
| author | winter Sparkles | 2026-08-09 16:17:29 +0100 |
|---|---|---|
| committer | winter Sparkles | 2026-08-09 16:17:29 +0100 |
| commit | b0d91b0db3576a2dc7b4ebac518724d8063c5de1 (patch) | |
| tree | 0da44d6f872d720719d00c1f081d2670e36d12cb /routes/integration | |
| parent | a621cd1aca6d44c24e4ab4234e7753acc3fb6613 (diff) | |
fix auth-request so it works better
Diffstat (limited to 'routes/integration')
| -rw-r--r-- | routes/integration/auth-request.php | 10 |
1 files changed, 6 insertions, 4 deletions
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); } |
