Bug 55886 - Apache 2.4 - incorrect (proxy, but not user) IP on server-status page
Summary: Apache 2.4 - incorrect (proxy, but not user) IP on server-status page
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_status (show other bugs)
Version: 2.4.10
Hardware: PC Linux
: P2 major with 2 votes (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-15 13:54 UTC by Alexey
Modified: 2015-01-23 10:17 UTC (History)
1 user (show)



Attachments
Record useragent IP in scoreboard (617 bytes, patch)
2014-06-11 10:27 UTC, Dave
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey 2013-12-15 13:54:21 UTC
I use Apache 2.4 with mod_realip and it works fine for custom_log - with LogFormat modifier %a i get user IP in access_log from nginx X-Real-IP HTTP header. But on status page i see nginx proxy address 127.0.0.1

In config i have:
RemoteIPHeader X-Real-IP
RemoteIPInternalProxy 127.0.0.0/8 ::1 
<Location /server-status>
    SetHandler server-status
    Require host 127.0.0.1
</Location>

I spent about half of a day to find a solution but with no success. Some people tried to use ported mod_praf for 2.4, some did not find any solution.

http://www.gossamer-threads.com/lists/apache/users/426859
Comment 1 Mike Rumph 2014-01-03 17:11:06 UTC
Okay, I did some research on this.

First of all, I get the same results in httpd trunk.

The timing between logging and mod_status appears to be okay.
But the two modules are taking information from two different locations.

mod_status is getting the client information from the "client" field in the scoreboard record.
The "client" field in the scoreboard record is updated in update_child_status_internal() in server/scoreboard.c by calling ap_get_remote_host().

But as for the logging format fields:
%a comes from request->useragent_ip
%{c}a comes from request->connection->client_ip
%h comes from ap_get_remote_host()

So according to the code what you see in the %h field in the log is what you will see in the client fields in the server_status page.

But this disagrees with what I see in the mod_remoteip documentation:
- http://httpd.apache.org/docs/trunk/mod/mod_remoteip.html
"Once replaced as instructed, this overridden useragent IP address is then used for the mod_authz_host <Require ip> feature, is reported by mod_status, and is recorded by mod_log_config %a and core %a format strings. The underlying client IP of the connection is available in the %{c}a format string."

So either the documentation should be changed or update_child_status_internal() should be using request->useragent_ip to update the "client" field.
Comment 2 phpfpm1 2014-04-13 10:51:39 UTC
Any news about the issue?
Comment 3 Dave 2014-06-11 10:27:27 UTC
Created attachment 31706 [details]
Record useragent IP in scoreboard
Comment 4 Dave 2014-06-11 10:30:15 UTC
I've also noticed this - a simple solution is to record the useragent instead of connection IP in the scoreboard, although it may not be the behaviour expected or desired by everyone.
Comment 6 Yann Ylavic 2014-09-12 17:26:34 UTC
Reopening until backported to 2.4.x.
Comment 7 Yann Ylavic 2015-01-23 10:17:36 UTC
Backported to 2.4.11 in r1627744.