Bug 57451 - TRIVIAL: Add specifier to the Header/RequestHeader to provide IP address of the client (early or late)
Summary: TRIVIAL: Add specifier to the Header/RequestHeader to provide IP address of t...
Status: RESOLVED DUPLICATE of bug 47447
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_headers (show other bugs)
Version: 2.4.10
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2015-01-17 13:07 UTC by Alexey Asemov
Modified: 2019-06-15 06:21 UTC (History)
0 users

the trivial patch (1.11 KB, text/plain)
2015-01-17 13:07 UTC, Alexey Asemov

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Asemov 2015-01-17 13:07:27 UTC
Created attachment 32373 [details]
the trivial patch

I propose to add trivial enhancement to the mod_headers: allow to use client IP in header value by using %a specifier. The patch is rather trivial too.

What it provides:

When used on frontend like

RequestHeader set X-Client-IP %a

It provides X-Client-IP header to pass through the proxy module (that is, if you don't want to use X-Forwarder-For header for realip module, and proxy module has no option to change the name). This variant works after realip, so it retrieves the first client IP if used together with realip.

When used on backend like

RequestHeader set X-Frontend-IP %a early

it sets X-Frontend-IP header to the last frontend IP (direct IP) accessing this server.

So it's useful to easily retrieve first/last IPs in forwarding sequence for scripts.
Comment 1 Alexey Asemov 2015-01-17 14:12:56 UTC
Sorry, duplicated.
Comment 2 Mathieu Parent 2016-09-16 13:14:51 UTC
It's a dupe of #47447.
Comment 3 Christophe JAILLET 2019-06-15 06:21:13 UTC

*** This bug has been marked as a duplicate of bug 47447 ***