Merge branch 'reverse-proxy-https' into 'develop'
Set URLs to https if HTTP X-Forwarded-Proto=https This line changes all URLs to https URLs if the Framadate installation is behind a reverse proxy, and the reverse proxy adds the X-Forwarded-Proto header with the 'https' value. Configuration for nginx: > proxy_set_header X-Forwarded-Proto https; This setup is currently used by the Framadate installation of Bits of Freedom (https://kies.bof.nl). See merge request !77
This commit is contained in:
commit
fd5cfe3ca6
@ -23,7 +23,7 @@ class Utils {
|
|||||||
* @return string Server name
|
* @return string Server name
|
||||||
*/
|
*/
|
||||||
public static function get_server_name() {
|
public static function get_server_name() {
|
||||||
$scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') ? 'https' : 'http';
|
$scheme = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')) ? 'https' : 'http';
|
||||||
$port = in_array($_SERVER['SERVER_PORT'], [80, 443]) ? '' : ':' . $_SERVER['SERVER_PORT'];
|
$port = in_array($_SERVER['SERVER_PORT'], [80, 443]) ? '' : ':' . $_SERVER['SERVER_PORT'];
|
||||||
$dirname = dirname($_SERVER['SCRIPT_NAME']);
|
$dirname = dirname($_SERVER['SCRIPT_NAME']);
|
||||||
$dirname = $dirname === '\\' ? '/' : $dirname . '/';
|
$dirname = $dirname === '\\' ? '/' : $dirname . '/';
|
||||||
|
Loading…
Reference in New Issue
Block a user