Use Webman session cookie settings for local login

This commit is contained in:
2026-11-21 18:55:05 +08:00
parent 908f9385fb
commit 188a63fb2f
3 changed files with 5 additions and 20 deletions
-14
View File
@@ -19,20 +19,6 @@ final class Request extends \support\Request
return inet_ntop(inet_pton($forwarded));
}
protected function setSidCookie(string $sessionName, string $sid, array $cookieParams): void
{
$proto = $this->fromTrustedProxy() ? $this->header('x-forwarded-proto', '') : '';
if ($proto === 'https') {
$cookieParams['secure'] = true;
} elseif (getenv('LAYSENSE_SECURE_COOKIES') === false
&& in_array($this->getRemoteIp(), self::LOOPBACK, true)
&& in_array(strtolower((string) $this->host(true)), ['localhost', '127.0.0.1', '[::1]', '::1'], true)
&& in_array($proto, ['', 'http'], true)) {
$cookieParams['secure'] = false;
}
parent::setSidCookie($sessionName, $sid, $cookieParams);
}
private function fromTrustedProxy(): bool
{
$configured = getenv('LAYSENSE_TRUSTED_PROXIES');