Hi Angelo. I'm assuming you're using mod_proxy_http (you said port 80). If so, then there is indeed a way to make this work.
In your Apache HTTPD config, where you're configuring proxying the request, make sure you add: ProxyVia On That will make HTTPD set the "x-forwarded-for" HTTP request header's value to the IP address of the client. This is passed to Tomcat when HTTPD proxies the request. Then, where you're configuring the AccessLogValve (usually in your conf/server.xml file), change the default logging pattern to log the "x-forwarded-for" header value, like this: <Host ...> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%{x-forwarded-for}i %l %u %t %r %s %b" resolveHosts="false"/> </Host> With that configuration, AccessLogValve will log the x-forwarded-for header value that is set by Apache HTTPD's mod_proxy, and the remainder of the logging pattern will be the same as usual. Cheers. -- Jason Brittain On Thu, Sep 17, 2009 at 6:01 AM, Angelo Chen <angelochen...@yahoo.com.hk>wrote: > > Hi, > I run tomcat behind an Apache server, Apache will proxy to tomcat from port > 80, this works quite well, but the access log in tomcat shows only > 127.0.0.1, not the real IP: > > 127.0.0.1 - - [17/Sep/2009:08:51:21 -0400] "POST /sendmsg HTTP/1.1" 302 - > > any idea how to have real IP in the log? > > Thanks, > -- > View this message in context: > http://www.nabble.com/access-log-and-Apache-server-tp25490807p25490807.html > Sent from the Tomcat - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >