Bug 47601 - Support X-Forwarded-For in forward proxy requests
Summary: Support X-Forwarded-For in forward proxy requests
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy_http (show other bugs)
Version: 2.2.11
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Keywords: MassUpdate
Depends on:
Reported: 2009-07-29 09:14 UTC by evanc
Modified: 2018-11-07 21:09 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description evanc 2009-07-29 09:14:43 UTC
mod_proxy_http prevents adding X-Forwarded-For in forwards proxy, to protect the privacy of the user in (I assume) the situation where Apache is used as an Internet proxy.  We are using Apache as a forwards proxy to control access to internal websites, and in this case adding X-Forwarded-For is very desirable.

Can adding (and even stripping for additional privacy) X-Forwarded-For be made configurable?  The feature could be disabled by default for forwards proxy and enabled by default for reverse proxy to maintain the current behaviour by default.
Comment 1 William A. Rowe Jr. 2009-07-29 23:45:27 UTC
No, it does not "prevent".  Any X-Forwarded-For entries are forwarded.
You are asking for it to "append" the proxy's client.

Reasonable request.  The obvious solution is simple;

RequestHeader append X-Forwarded-For "%a"


RequestHeader append X-Forwarded-For "%{REMOTE_ADDR}e" 

Quick testing reveals that neither solution works.

As utilization blocking dictates, this is needed for larger proxies;

Comment 2 evanc 2009-07-30 03:08:32 UTC
"Prevents" may not have been exactly the right word, but it seems like we agree on what Apache does now and what it should be able to do.  My hope is that there can be a configuration option just like ProxyVia for managing XFF (with on/off/block capability).

Also, the current XFF code in mod_proxy_http does not seem to have the correct behaviour when the request already had an XFF (multiple proxies between the client and server).  The XFF format is:

X-Forwarded-For: original-client, first-proxy, second-proxy, etc.

If I interpret the code correctly, the mod_proxy_http XFF implementation (for reverse proxies) assumes that the current instance is the only proxy, as does the RequestHeader suggestion.
Comment 3 Felix Ostmann 2010-03-09 13:47:37 UTC
still very important!

We had to copy mod_proxy_http.c to mod_proxy_http_without_forwarded.c, modify, build and setup.

Simple one options like ProxyVia would be great!
Comment 4 William A. Rowe Jr. 2018-11-07 21:09:51 UTC
Please help us to refine our list of open and current defects; this is a mass update of old and inactive Bugzilla reports which reflect user error, already resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases. The final release 2.2.34 was published in July 2017, and no further evaluation of bug reports or security risks will be considered or published for 2.2.x releases. All reports older than 2.4.x have been updated to status RESOLVED/LATER; no further action is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd feature, an unexpected server behavior, problems building or installing httpd, or working with an external component (a third party module, browser etc.) we ask you to start by bringing your question to the User Support and Discussion mailing list, see [https://httpd.apache.org/lists.html#http-users] for details. Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that you retest using a modern httpd release (2.4.33 or later) released in the past year. If it can be reproduced, please reopen this bug and change the Version field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the current httpd server software release is greatly appreciated.