From 546980249e9bf29aa8d542e988a0f92a9607996d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 20 Jul 2020 14:03:55 +0200 Subject: [PATCH] Add a switch to force 'assume SSL' mode behind a reverse proxy, when the RP adds SSL and the internal connection is HTTP only. --- airtime_mvc/application/common/HTTPHelper.php | 3 ++- airtime_mvc/application/configs/conf.php | 1 + airtime_mvc/build/airtime.example.conf | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/common/HTTPHelper.php b/airtime_mvc/application/common/HTTPHelper.php index 80e6fd16e..c3ff70858 100644 --- a/airtime_mvc/application/common/HTTPHelper.php +++ b/airtime_mvc/application/common/HTTPHelper.php @@ -31,6 +31,7 @@ class Application_Common_HTTPHelper $baseUrl = $CC_CONFIG['baseUrl']; $baseDir = $CC_CONFIG['baseDir']; $basePort = $CC_CONFIG['basePort']; + $forceSSL = $CC_CONFIG['forceSSL']; if (empty($baseDir)) { $baseDir = "/"; } @@ -42,7 +43,7 @@ class Application_Common_HTTPHelper } $scheme = "http"; - if ($secured && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') { + if ($forceSSL || ($secured && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')) { $scheme = "https"; $basePort = "443"; //Airtime Pro compatibility hack } diff --git a/airtime_mvc/application/configs/conf.php b/airtime_mvc/application/configs/conf.php index 964225e8c..6295d410e 100644 --- a/airtime_mvc/application/configs/conf.php +++ b/airtime_mvc/application/configs/conf.php @@ -31,6 +31,7 @@ class Config { $CC_CONFIG['basePort'] = $values['general']['base_port']; $CC_CONFIG['stationId'] = $values['general']['station_id']; $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'])) { $CC_CONFIG['dev_env'] = $values['general']['dev_env']; } else { diff --git a/airtime_mvc/build/airtime.example.conf b/airtime_mvc/build/airtime.example.conf index 96487f3ce..7e3ebf479 100644 --- a/airtime_mvc/build/airtime.example.conf +++ b/airtime_mvc/build/airtime.example.conf @@ -53,6 +53,7 @@ web_server_user = www-data base_url = localhost base_port = 80 base_dir = / +force_ssl = cache_ahead_hours = 1 airtime_dir = station_id =