diff options
author | Delan Azabani <delan@azabani.com> | 2014-09-15 02:31:30 +0800 |
---|---|---|
committer | Delan Azabani <delan@azabani.com> | 2014-09-15 02:31:30 +0800 |
commit | 828bf6b540b5d4af03cb326462d5d7cd167ab95f (patch) | |
tree | 6c44f3ea6b1f31c90fc2198faa0e3793fcf2ac19 /mod_ip.c | |
parent | 1eb61f3171f2cd81d741f8f31ef62beda778e942 (diff) | |
download | mod_ip-828bf6b540b5d4af03cb326462d5d7cd167ab95f.tar.gz mod_ip-828bf6b540b5d4af03cb326462d5d7cd167ab95f.zip |
allow falling-sky to run behind a reverse proxy using Apache >= 2.4
If one configures falling-sky to run behind e.g. nginx, then the
user's IP address will be falsely reported as 127.0.0.1 or ::1, even
if the X-Forwarded-For and X-Real-IP headers are set correctly.
This patch fixes the problem iff compiled against Apache >= 2.4.
Diffstat (limited to 'mod_ip.c')
-rw-r--r-- | mod_ip.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -122,9 +122,9 @@ const char *padding_buffer = "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldH #if AP_SERVER_MAJORVERSION_NUMBER > 2 || \ (AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER >= 4) -#define CLIENT_IP(conn) ((conn)->client_ip) +#define CLIENT_IP(request) ((request)->useragent_ip) #else -#define CLIENT_IP(conn) ((conn)->remote_ip) +#define CLIENT_IP(request) ((request)->connection->remote_ip) #endif typedef struct mod_ip_request_t @@ -355,7 +355,7 @@ gen_output (request_rec * r, struct mod_ip_request_t *formdata) char *padding = ",\"padding\":\""; char *p = NULL; int added = 0; - char *myip = CLIENT_IP(r->connection); + char *myip = CLIENT_IP(r); char *mytype = "ipv4"; char *mysubtype = ""; char *VIA = ""; |