diff options
author | dipsol <martin@diphoorn.com> | 2011-09-15 09:21:45 +0200 |
---|---|---|
committer | dipsol <martin@diphoorn.com> | 2011-09-15 09:21:45 +0200 |
commit | c6b25468d60b061156cf92aabcb6f123c5155d1f (patch) | |
tree | 7a45cef7b2d53aa0130b845e2676662cf6972c5d /lib | |
parent | fcc8ff2842b9cc5a6d70cc5d4c464ab962623863 (diff) | |
download | ampache-c6b25468d60b061156cf92aabcb6f123c5155d1f.tar.gz ampache-c6b25468d60b061156cf92aabcb6f123c5155d1f.tar.bz2 ampache-c6b25468d60b061156cf92aabcb6f123c5155d1f.zip |
FS#190 - Add support for HTTP_FORWARDED (Forum patch)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/init.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/init.php b/lib/init.php index 732ad5b5..757eb8f7 100644 --- a/lib/init.php +++ b/lib/init.php @@ -55,7 +55,9 @@ Config::set('prefix',$prefix); /* Check to see if this is http or https */ -if ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || Config::get('force_ssl') == true) { +if ((isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) + || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') + || Config::get('force_ssl') == true) { $http_type = "https://"; } else { @@ -98,7 +100,11 @@ $results['int_config_version'] = '11'; $results['raw_web_path'] = $results['web_path']; $results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; -$results['http_port'] = $_SERVER['SERVER_PORT']; +if (isset($_SERVER['HTTP_X_FORWARDED_PORT'])) { + $results['http_port'] = $_SERVER['HTTP_X_FORWARDED_PORT']; +} else { + $results['http_port'] = $_SERVER['SERVER_PORT']; +} if (!$results['http_port']) { $results['http_port'] = '80'; } |