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
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.
Any news about the issue?
Created attachment 31706 [details] Record useragent IP in scoreboard
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.
It's fixed in trunk now: https://github.com/apache/httpd/commit/4587109ba9396e5581c66f8fa8db2fd80a809313#diff-4daad1c6042697da3da10556cbc8615f
Reopening until backported to 2.4.x.
Backported to 2.4.11 in r1627744.