Create a gist now

Instantly share code, notes, and snippets.

scrip_name_proxy.patch
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 5b28e98..a9b3410 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -438,7 +438,14 @@ function conf_init() {
// $_SERVER['SCRIPT_NAME'] can, in contrast to $_SERVER['PHP_SELF'], not
// be modified by a visitor.
- if ($dir = trim(dirname($_SERVER['SCRIPT_NAME']), '\,/')) {
+
+ // Allow serving through proxy
+ $scriptName = $_SERVER['SCRIPT_NAME'];
+ if (isset($_SERVER['HTTP_X_SCRIPT_NAME'])) {
+ $scriptName = $_SERVER['HTTP_X_SCRIPT_NAME'];
+ }
+
+ if ($dir = trim(dirname($scriptName), '\,/')) {
$base_path = "/$dir";
$base_url .= $base_path;
$base_path .= '/';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment