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).
This commit is contained in:
parent
5ffc332b48
commit
7ba352f0e5
@ -23,7 +23,7 @@ class Utils {
|
||||
* @return string 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'];
|
||||
$dirname = dirname($_SERVER['SCRIPT_NAME']);
|
||||
$dirname = $dirname === '\\' ? '/' : $dirname . '/';
|
||||
|
Loading…
Reference in New Issue
Block a user