Logging of client IP rather than the IP of the Proxy

Bug #143352 reported by Robert Munro
2
Affects Status Importance Assigned to Milestone
Zope 2
Invalid
Medium
Unassigned

Bug Description

The Z2.log file contains the IP addresses of the client accessing zope. Because 99% of the time, zope is deployed behind a reverse proxy, the Z2.log file normally logs the IP address of that proxy for all hits, rather then the IP address of the client. The attached patch makes it log the actual client address as given by the "x-forwarded-for" header that is added by the proxy. Note that in the case of the request going through several proxies, each proxy adds another address to the x-forwarded for header (comma separated), but this patch logs only the last one.

Tags: bugday
Revision history for this message
Robert Munro (rjmunro) wrote :
Revision history for this message
Robert Munro (rjmunro) wrote :

I forgot to put that this is for zope version 2.7.4 & I can't seem to edit that field now.

Revision history for this message
Florent Guillaume (efge) wrote :

I'd be for including this if it was dependent on the trusted-proxy directive in zope.conf.

Revision history for this message
Erica Windisch (ewindisch) wrote :

Uploaded: 2

The prior patch would throw an exception if X-FORWARDED-FOR was not set. This would be a problem if medusa was contacted directly, rather than through the reverse proxy. This patch fixes that problem and has proven stable in production use.

Tres Seaver (tseaver)
Changed in zope2:
status: New → Triaged
tags: added: bugday
removed: feature+solution zope
Revision history for this message
fatfabubuntu (fabfabfab) wrote :

 hi even with ifconfig i havent my ip code, or clone mac add.. i see different ssid bssid essid and ssid,have u got some commands to have fresh codes!once i saw new ip code is it that it can be change with new versions?

Revision history for this message
Patrick Gerken (do3cc) wrote :

Will be fixed in 2.13.20:
https://github.com/zopefoundation/Zope/commit/1b373937f9557f14d07d938d2e927bfebf2d75ee

I did not use the patch, instead I adapted it to also take care of the trusted-proxy settings.
So for this to have any effect, trusted-proxy must be set properly

Revision history for this message
Colin Watson (cjwatson) wrote :

The zope2 project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zope2.

Changed in zope2:
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.