mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
Better https detection (patched from develop)
This commit is contained in:
parent
1c55d4a220
commit
d73aceb272
10
common.php
10
common.php
@ -115,7 +115,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('ADMIN_URL', SERVER_URL . BASE_DIR . '/admin/');
|
||||
|
||||
@ -125,3 +125,11 @@ if(!IS_CLI) {
|
||||
}
|
||||
}
|
||||
require SYSTEM . 'autoload.php';
|
||||
|
||||
function isHttps(): bool
|
||||
{
|
||||
return
|
||||
(!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https')
|
||||
|| (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|
||||
|| (isset($_SERVER['SERVER_PORT']) && (int) $_SERVER['SERVER_PORT'] === 443);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user