[CalendarServer-changes] [14957] CalendarServer/trunk/calendarserver/accesslog.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jul 10 13:00:04 PDT 2015
Revision: 14957
http://trac.calendarserver.org//changeset/14957
Author: cdaboo at apple.com
Date: 2015-07-10 13:00:04 -0700 (Fri, 10 Jul 2015)
Log Message:
-----------
Use X-F-F header value for client IP address when using unix socket based proxy.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/accesslog.py
Modified: CalendarServer/trunk/calendarserver/accesslog.py
===================================================================
--- CalendarServer/trunk/calendarserver/accesslog.py 2015-07-09 00:27:00 UTC (rev 14956)
+++ CalendarServer/trunk/calendarserver/accesslog.py 2015-07-10 20:00:04 UTC (rev 14957)
@@ -181,6 +181,13 @@
format += " fwd=%(fwd)s"
formatArgs["fwd"] = forwardedFor
+ if formatArgs["host"] == "0.0.0.0":
+ fwdHeaders = request.headers.getRawHeaders("x-forwarded-for", "")
+ if fwdHeaders:
+ formatArgs["host"] = fwdHeaders[-1].split(",")[-1].strip()
+ format += " unix=%(unix)s"
+ formatArgs["unix"] = "true"
+
elif "overloaded" in eventDict:
overloaded = eventDict.get("overloaded")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150710/cc89af83/attachment.html>
More information about the calendarserver-changes
mailing list