Configuring log line format (headers)

30 views
Skip to first unread message

Richard Lewis

unread,
Nov 10, 2009, 12:00:29 PM11/10/09
to cherrypy-users
Hi there,

My CherryPy application is running behind Apache and so the host
portion of my access and error log lines is always '127.0.0.1'. Of
course, Apache gives CherryPy the original requesting host in X-
Forwarded-For' (I think). But how do I configure CherryPy's log
messages to include this X-Forwarded-For host header instead of the
Host header?

Cheers,
Richard

Jason Earl

unread,
Nov 10, 2009, 7:02:22 PM11/10/09
to cherryp...@googlegroups.com
I have something like this in my config file, and it does the right
thing.

[global]
tools.proxy.on
tools.proxy.local = "X-Forwarded-Host"
tools.proxy.remote = "X-Forwarded-For"

Richard Lewis

unread,
Nov 13, 2009, 12:29:38 PM11/13/09
to cherrypy-users
Ah brilliant. Works perfectly. Thanks.
Reply all
Reply to author
Forward
0 new messages