From 5edfed5bfcdc62faa720d852c4d7e556d3c7e4b2 Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Sun, 4 Mar 2018 16:48:36 +0000 Subject: [PATCH] Enable https for proxy offloading --- README.md | 2 ++ application/config/config.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f99571a3f..6b25c7891 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,8 @@ FAQ * If you have problems with the encryption support or you get an error please make sure `php-openssl` is installed. With PHP 7 MCrypt is deprecated so you must use OpenSSL. +* If you install ospos in docker behind a proxy that performs ssloffloading, you can enable the url generated to be https instead of http, by activating the environment variable FORCE_HTTPS = 1. + * If you have suhosin installed and face an issue with CSRF, please make sure you read [issue #1492](https://github.com/opensourcepos/opensourcepos/issues/1492). * If new customer or supplier fails please make sure `php-mbstring` is installed see [issue #1673](https://github.com/opensourcepos/opensourcepos/issues/1673) for more details. diff --git a/application/config/config.php b/application/config/config.php index 94a0b5aa5..83ebcd898 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -65,7 +65,7 @@ $config['db_log_enabled'] = FALSE; | a PHP script and you can easily do that on your own. | */ -$config['base_url'] = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; +$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || isset($_ENV['FORCE_HTTPS'])) ? 'https' : 'http'; $config['base_url'] .= '://' . $_SERVER['HTTP_HOST']; $config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);