Last active
August 29, 2015 14:23
-
-
Save gansbrest/7b8c5138bfcb48d4192e to your computer and use it in GitHub Desktop.
http_host_proxy.patch
This file contains 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
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc | |
index 80b6eb1..5b28e98 100644 | |
--- a/includes/bootstrap.inc | |
+++ b/includes/bootstrap.inc | |
@@ -333,7 +333,15 @@ function conf_path($require_settings = TRUE, $reset = FALSE) { | |
$confdir = 'sites'; | |
$uri = explode('/', $_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['SCRIPT_FILENAME']); | |
- $server = explode('.', implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.'))))); | |
+ | |
+ // Special reverse proxy patch to allow prserve original HTTP_HOST header | |
+ // but load correct settings.php file | |
+ $settingsHeader = $_SERVER['HTTP_HOST']; | |
+ if (isset($_SERVER['HTTP_HOST_PROXY'])) { | |
+ $settingsHeader = $_SERVER['HTTP_HOST_PROXY']; | |
+ } | |
+ | |
+ $server = explode('.', implode('.', array_reverse(explode(':', rtrim($settingsHeader, '.'))))); | |
for ($i = count($uri) - 1; $i > 0; $i--) { | |
for ($j = count($server); $j > 0; $j--) { | |
$dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment