detect https coming through reverse proxy or load balancer using x-forwarded-proto instead of (actually in addition to testing) $_SERVER['HTTPS'] and/or $_SERVER['SERVER_PORT'] to indicate ssl is enabled

This commit is contained in:
friendica 2015-01-05 16:12:55 -08:00
parent 3df3ab5630
commit 3185bfe3ca

View File

@ -472,6 +472,8 @@ function script_path() {
$scheme = 'https';
elseif(x($_SERVER,'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443))
$scheme = 'https';
elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on')
$scheme = 'https';
else
$scheme = 'http';