1
0
mirror of git://f0xx.org/ac/ac-platform-php synced 2026-07-29 04:58:36 +03:00

fix(session): honor X-Forwarded-Proto; widen auth route matching

Secure session cookies behind TLS-terminating FE. resolve_console_route
recognizes /two-factor/approve and /api/two-factor/poll.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Anton Afanasyeu
2026-07-05 19:12:53 +02:00
parent 0ebb12b52d
commit e482d56ef5
2 changed files with 4 additions and 2 deletions

View File

@@ -11,12 +11,14 @@ function platform_start_session(string $sessionName = 'ac_crash_sess', string $c
return;
}
session_name($sessionName);
$secure = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|| strtolower((string) ($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '')) === 'https';
session_set_cookie_params([
'lifetime' => 0,
'path' => $cookiePath,
'httponly' => true,
'samesite' => 'Lax',
'secure' => (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'),
'secure' => $secure,
]);
session_start();
}