You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Johan van Reijendam <jv...@systems.dhl.com> on 1998/07/29 21:18:21 UTC
mod_proxy/2739: Forward the client IP address to back-end server when proxying request
>Number: 2739
>Category: mod_proxy
>Synopsis: Forward the client IP address to back-end server when proxying request
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: apache
>State: open
>Class: change-request
>Submitter-Id: apache
>Arrival-Date: Wed Jul 29 12:20:00 PDT 1998
>Last-Modified:
>Originator: jvanreij@systems.dhl.com
>Organization:
apache
>Release: 1.3.0
>Environment:
Change was tested on HPUX-10.20 and Solaris 2.[5-6] using
Apache-1.3b2, 1.3.0
>Description:
We currently use Apache to reverse proxy an increasing number of internal
web sites. When requests are proxied however there is little or no info
available to the back-end server to perform statistical analysis regarding what
users are hitting what pages.
In order to remedy this a change was made to the mod_proxy.c module to make it
possible to forward the IP address of the connecting browser/client.
This information is placed in an additional HTTP header sent to the back-end
host.
Please let me know if this is an acceptable submission.
Regards
>How-To-Repeat:
>Fix:
diff -C3 output :
--------8<-------
*** mod_proxy-old.c Wed Jul 29 12:01:02 1998
--- mod_proxy.c Wed Jul 29 12:04:34 1998
***************
*** 195,200 ****
--- 195,207 ----
r->uri + len, NULL);
r->handler = "proxy-server";
r->proxyreq = 1;
+
+ /* Add client IP to headers */
+
+ if ( conf->forward_client_ip ) {
+ table_set( r->headers_out, "Client_IP", r->connection->remote_ip );
+ }
+
return OK;
}
}
***************
*** 577,582 ****
--- 584,600 ----
}
static const char *
+ forward_client_ip(cmd_parms *parms, void *dummy, int flag)
+ {
+ proxy_server_conf *psf =
+ get_module_config(parms->server->module_config, &proxy_module);
+
+ psf->forward_client_ip = flag;
+ return NULL;
+ }
+
+
+ static const char *
set_proxy_req(cmd_parms *parms, void *dummy, int flag)
{
proxy_server_conf *psf =
***************
*** 783,788 ****
--- 801,808 ----
"The number of characters in subdirectory names"},
{"NoCache", set_cache_exclude, NULL, RSRC_CONF, ITERATE,
"A list of names, hosts or domains for which caching is *not* provided"},
+ {"ForwardClientIP", forward_client_ip, NULL, RSRC_CONF, FLAG,
+ "on if the client ip address should be forwarded"},
{NULL}
};
---------8<--------
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <ap...@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED. This is not done]
[automatically because of the potential for mail loops. ]