Add a switch to force 'assume SSL' mode behind a reverse proxy, when the RP adds SSL and the internal connection is HTTP only.

This commit is contained in:
Thomas Göttgens 2020-07-20 14:03:55 +02:00
parent cf84f82eae
commit 546980249e
3 changed files with 4 additions and 1 deletions

View file

@ -31,6 +31,7 @@ class Application_Common_HTTPHelper
$baseUrl = $CC_CONFIG['baseUrl']; $baseUrl = $CC_CONFIG['baseUrl'];
$baseDir = $CC_CONFIG['baseDir']; $baseDir = $CC_CONFIG['baseDir'];
$basePort = $CC_CONFIG['basePort']; $basePort = $CC_CONFIG['basePort'];
$forceSSL = $CC_CONFIG['forceSSL'];
if (empty($baseDir)) { if (empty($baseDir)) {
$baseDir = "/"; $baseDir = "/";
} }
@ -42,7 +43,7 @@ class Application_Common_HTTPHelper
} }
$scheme = "http"; $scheme = "http";
if ($secured && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') { if ($forceSSL || ($secured && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')) {
$scheme = "https"; $scheme = "https";
$basePort = "443"; //Airtime Pro compatibility hack $basePort = "443"; //Airtime Pro compatibility hack
} }

View file

@ -31,6 +31,7 @@ class Config {
$CC_CONFIG['basePort'] = $values['general']['base_port']; $CC_CONFIG['basePort'] = $values['general']['base_port'];
$CC_CONFIG['stationId'] = $values['general']['station_id']; $CC_CONFIG['stationId'] = $values['general']['station_id'];
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir']; $CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
$CC_CONFIG['forceSSL'] = isset($values['general']['force_ssl']) ? $values['general']['force_ssl'] : FALSE;
if (isset($values['general']['dev_env'])) { if (isset($values['general']['dev_env'])) {
$CC_CONFIG['dev_env'] = $values['general']['dev_env']; $CC_CONFIG['dev_env'] = $values['general']['dev_env'];
} else { } else {

View file

@ -53,6 +53,7 @@ web_server_user = www-data
base_url = localhost base_url = localhost
base_port = 80 base_port = 80
base_dir = / base_dir = /
force_ssl =
cache_ahead_hours = 1 cache_ahead_hours = 1
airtime_dir = airtime_dir =
station_id = station_id =