Last active
August 29, 2015 14:10
-
-
Save deviantintegral/7c647c4ba286b129ee0d 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
commit 44541abb698972fdd27814919c75aae1ac542a46 | |
Author: Andrew Berry <[email protected]> | |
Date: Mon Nov 3 10:22:19 2014 -0500 | |
Patch Drupal to use the leftmost IP address for client IP. | |
diff --git a/docroot/includes/bootstrap.inc b/docroot/includes/bootstrap.inc | |
index c8d17f5..57c69d9 100644 | |
--- a/docroot/includes/bootstrap.inc | |
+++ b/docroot/includes/bootstrap.inc | |
@@ -2919,8 +2919,8 @@ function ip_address() { | |
// Eliminate all trusted IPs. | |
$untrusted = array_diff($forwarded, $reverse_proxy_addresses); | |
- // The right-most IP is the most specific we can trust. | |
- $ip_address = array_pop($untrusted); | |
+ // The left-most IP is the original client IP address. | |
+ $ip_address = array_shift($untrusted); | |
} | |
} | |
} | |
diff --git a/patches/drupal/leftmost-forwarded-ip-address.patch b/patches/drupal/leftmost-forwarded-ip-address.patch | |
new file mode 100644 | |
index 0000000..4862d5b | |
--- /dev/null | |
+++ b/patches/drupal/leftmost-forwarded-ip-address.patch | |
@@ -0,0 +1,15 @@ | |
+diff --git a/docroot/includes/bootstrap.inc b/docroot/includes/bootstrap.inc | |
+index c8d17f5..57c69d9 100644 | |
+--- a/docroot/includes/bootstrap.inc | |
++++ b/docroot/includes/bootstrap.inc | |
+@@ -2919,8 +2919,8 @@ function ip_address() { | |
+ // Eliminate all trusted IPs. | |
+ $untrusted = array_diff($forwarded, $reverse_proxy_addresses); | |
+ | |
+- // The right-most IP is the most specific we can trust. | |
+- $ip_address = array_pop($untrusted); | |
++ // The left-most IP is the original client IP address. | |
++ $ip_address = array_shift($untrusted); | |
+ } | |
+ } | |
+ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment