Fix IPv6 address in cookie domain (#1137)

* Implement getCookieHost to extract cookie host from HTTP_HOST
This commit is contained in:
Nicolas Thumann
2023-05-10 08:26:08 +02:00
committed by GitHub
parent 68cf4ab69a
commit 78a259ef3b
2 changed files with 25 additions and 4 deletions

View File

@@ -331,11 +331,10 @@ if (CurrentUser::hasSession()) {
}
}
// update cookie lifetime
$cookie_host = empty($_SERVER['HTTP_HOST']) ? null : explode (':', $_SERVER['HTTP_HOST'])[0];
$cookie_params = [
'expires' => time() + Settings::Get('session.sessiontimeout'),
'path' => '/',
'domain' => $cookie_host,
'domain' => UI::getCookieHost(),
'secure' => UI::requestIsHttps(),
'httponly' => true,
'samesite' => 'Strict'