You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by John Saario <sj...@alamak.com.sg> on 1997/12/12 07:08:43 UTC

mod_proxy/1547: No HTTP_X_FORWARDED_FOR set...

>Number:         1547
>Category:       mod_proxy
>Synopsis:       No HTTP_X_FORWARDED_FOR set...
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          change-request
>Submitter-Id:   apache
>Arrival-Date:   Thu Dec 11 22:10:00 PST 1997
>Last-Modified:
>Originator:     sjohn@alamak.com.sg
>Organization:
apache
>Release:        apache_1.3b3
>Environment:
FreeBSD 2.1+
>Description:
It's nice if you can get the users real REMOTE_ADDR someway if you are
running a web server and the apache proxy doesn't forward this as in squid
to HTTP_X_FORWARDED_FOR ... I want to run a proxy to my other web servers
in the states but I want the real REMOTE_ADDR value for my cgi's there.
>How-To-Repeat:
It's not designed in the current version
>Fix:
I'm not a C programmer but I modified /src/modules/proxy/proxy_http.c
Probably you could skip the delcaration and stuff the pointers directly
into the bvputs line ... or do it the correct way by setting the values
with the normal set header routine, wherever that is?
/* declare */
char *forwarded = r->connection->remote_ip; /* jds */

    reqhdrs_arr = table_elts(r->headers_in);
    reqhdrs = (table_entry *) reqhdrs_arr->elts;
    for (i = 0; i < reqhdrs_arr->nelts; i++) {
        if (reqhdrs[i].key == NULL || reqhdrs[i].val == NULL
        /* Clear out headers not to send */
            || !strcasecmp(reqhdrs[i].key, "Host")      /* Already sent */
            ||!strcasecmp(reqhdrs[i].key, "Proxy-Authorization"))
            continue;
        bvputs(f, reqhdrs[i].key, ": ", reqhdrs[i].val, "\015\012", NULL);
    }
/* add in */
bvputs(f, "Forwarded", ": ", "via Apache ( hacked )" , "\015\012", NULL); /* jds */
bvputs(f, "X-Forwarded-For", ": ", forwarded, "\015\012", NULL); /* jds */
/* end add in */
%0
>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. ]