mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-24 15:40:12 +01:00
allow cloudflare and other proxies to still count as https
This commit is contained in:
parent
b2f246abb0
commit
091c0442e8
@ -6,5 +6,13 @@ namespace Vichan\Functions\Net;
|
|||||||
* @return bool Returns if the client-server connection is an encrypted one (HTTPS).
|
* @return bool Returns if the client-server connection is an encrypted one (HTTPS).
|
||||||
*/
|
*/
|
||||||
function is_connection_secure(): bool {
|
function is_connection_secure(): bool {
|
||||||
return !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off';
|
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user