Merge branch 'feature/force-https' into 'develop'
Allow overriding HTTPS See merge request framasoft/framadate/framadate!346
This commit is contained in:
commit
c4551c2e71
@ -28,7 +28,12 @@ class Utils {
|
||||
$serverName = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
|
||||
$serverPort = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : '';
|
||||
|
||||
$scheme = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')) ? 'https' : 'http';
|
||||
$scheme = (
|
||||
(defined('FORCE_HTTPS') && FORCE_HTTPS ) ||
|
||||
(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') ||
|
||||
(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
|
||||
) ? 'https' : 'http';
|
||||
|
||||
$port = in_array($serverPort, ['80', '443'], true) ? '' : ':' . $serverPort;
|
||||
$dirname = dirname($_SERVER['SCRIPT_NAME']);
|
||||
$dirname = $dirname === '\\' ? '/' : $dirname . '/';
|
||||
|
@ -3,6 +3,7 @@
|
||||
# Read environment variables or set default values
|
||||
FRAMADATE_CONFIG=${FRAMADATE_CONFIG:-/var/www/framadate/app/inc/config.php}
|
||||
DOMAIN=${DOMAIN-localhost}
|
||||
FORCE_HTTPS=${FORCE_HTTPS-false}
|
||||
APP_NAME=${APP_NAME-Framadate}
|
||||
ADMIN_MAIL=${ADMIN_MAIL-}
|
||||
NO_REPLY_MAIL=${NO_REPLY_MAIL-}
|
||||
@ -21,6 +22,9 @@ if [ ! -f $FRAMADATE_CONFIG ]; then
|
||||
if [ ! -z "$DOMAIN" ]; then
|
||||
sed -i -E "s/^(\/\/ )?const APP_URL( )?=.*;/const APP_URL = '$DOMAIN';/g" $FRAMADATE_CONFIG
|
||||
fi
|
||||
if [ "$FORCE_HTTPS" = true ]; then
|
||||
sed -i -E "s/^(\/\/ )?const FORCE_HTTPS\\s*=.*;/const FORCE_HTTPS = true;/" $FRAMADATE_CONFIG
|
||||
fi
|
||||
sed -i -E "s/^(\/\/ )?const NOMAPPLICATION( )?=.*;/const NOMAPPLICATION = '$APP_NAME';/g" $FRAMADATE_CONFIG
|
||||
# Configure mail
|
||||
sed -i -E "s/^(\/\/ )?const ADRESSEMAILADMIN( )?=.*;/const ADRESSEMAILADMIN = '$ADMIN_MAIL';/g" $FRAMADATE_CONFIG
|
||||
|
@ -22,6 +22,8 @@
|
||||
// You *have to set this* if you are running Framadate behind a reverse proxy.
|
||||
// const APP_URL = '<www.mydomain.fr>';
|
||||
|
||||
// const FORCE_HTTPS = false;
|
||||
|
||||
// Application name
|
||||
const NOMAPPLICATION = '{$appName|addslashes_single_quote}';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user