Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kazukomurata/9f0de6734fcf892c374fbae0d9b7f663 to your computer and use it in GitHub Desktop.
Save kazukomurata/9f0de6734fcf892c374fbae0d9b7f663 to your computer and use it in GitHub Desktop.
/**
* @file
* AWS configuration file.
*/
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'];
}
elseif (isset($_SERVER['HTTP_CLOUDFRONT_FORWARDED_PROTO'])) {
$base_root = $_SERVER['HTTP_CLOUDFRONT_FORWARDED_PROTO'];
}
// There's no HTTPS spoor -- we must be running HTTP.
else {
$base_root = 'http';
}
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
$http_host = $_SERVER['HTTP_X_FORWARDED_HOST'];
}
else {
$http_host = $_SERVER['HTTP_HOST'];
}
$base_url = $base_root .= '://' . $http_host;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment