-
-
Save chales/fd8b51ed2aae5e4e1c85 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Amazon Elastic Load Balancer Settings. | |
* | |
* Force server to use https:// path if SSL is handled at load balancer. | |
* | |
* @see http://drupal.org/node/185161#comment-5452038 | |
*/ | |
// We're running HTTPS natively in the web server. | |
if ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ) { | |
$base_root = 'https'; | |
} | |
// We're behind a proxy that talks to the web server via HTTP. | |
elseif ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) ) { | |
$base_root = $_SERVER['HTTP_X_FORWARDED_PROTO']; | |
} | |
// There's no HTTPS spoor -- we must be running HTTP. | |
else { | |
$base_root = 'http'; | |
} | |
$base_url = $base_root .= '://'. $_SERVER['HTTP_HOST']; | |
// $_SERVER['SCRIPT_NAME'] can, in contrast to $_SERVER['PHP_SELF'], not be modified by a visitor. | |
if ( $dir = trim(dirname($_SERVER['SCRIPT_NAME']), '\,/') ) { | |
$base_path = "/$dir"; | |
$base_url .= $base_path; | |
$base_path .= '/'; | |
} | |
else { | |
$base_path = '/'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment