1
0

Fix https redirects behind reverse-proxy
All checks were successful
Build Docker and Deploy / Build Docker (push) Successful in 42s
Build Docker and Deploy / Deploy to Server (push) Successful in 19s

This commit is contained in:
Mike Schwörer 2023-08-26 21:47:09 +02:00
parent 315c32983c
commit 711ea15347
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF

View File

@ -222,7 +222,11 @@ function getRandomToken($length = 32)
function isHTTPRequest()
{
return (!isset($_SERVER['HTTPS'])) || empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off";
if (isset($_SERVER['HTTP_X_FORWARDED_PROTOCOL']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTOCOL']) === "https" ) return false;
if (isset($_SERVER['HTTPS']) && (!empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== "off")) return false;
return true;
}
function str_max_len(string $str, int $max)