avoid warning when HTTP_X_FORWARDED_PROTO isn't set

This commit is contained in:
Shish 2022-01-01 10:29:32 +00:00
parent e0f1165b6c
commit 3061a9d7d5

View file

@ -66,7 +66,7 @@ function contact_link(): ?string
function is_https_enabled(): bool
{
// check forwarded protocol
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$_SERVER['HTTPS']='on';
}
return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off');