mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 01:39:22 +02:00
Better https detection
This commit is contained in:
parent
4a430ae9db
commit
3297a7c51a
10
common.php
10
common.php
@ -136,7 +136,7 @@ if(!IS_CLI) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define('SERVER_URL', 'http' . (isset($_SERVER['HTTPS'][0]) && strtolower($_SERVER['HTTPS']) === 'on' ? 's' : '') . '://' . $baseHost);
|
define('SERVER_URL', 'http' . (isHttps() ? 's' : '') . '://' . $baseHost);
|
||||||
define('BASE_URL', SERVER_URL . BASE_DIR . '/');
|
define('BASE_URL', SERVER_URL . BASE_DIR . '/');
|
||||||
define('ADMIN_URL', SERVER_URL . BASE_DIR . '/' . ADMIN_PANEL_FOLDER . '/');
|
define('ADMIN_URL', SERVER_URL . BASE_DIR . '/' . ADMIN_PANEL_FOLDER . '/');
|
||||||
|
|
||||||
@ -165,3 +165,11 @@ if (!is_file($autoloadFile)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
require $autoloadFile;
|
require $autoloadFile;
|
||||||
|
|
||||||
|
function isHttps(): bool
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https')
|
||||||
|
|| (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|
||||||
|
|| $_SERVER['SERVER_PORT'] == 443;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user