Configuration of Apache with Tomcat

Configuration of Apache with Tomcat

am 03.07.2007 19:15:51 von AMBhatti

I have worked with Apache for quite some time but I am new to Tomcat
within the last four weeks.

I have recently setup Apache 2.2 with Tomcat 5.5. Everything seems to
work fine with the *.jsp files being handed off to Tomcat via the
AJP1.3 connector. However, I have one "new" exception from the
developer that I am supporting with this setup.

When we use request.getRemoteHost() or request.getRemoteAddr() the
strings returned are all zeros (ie. 0.0.0.0). I have RTFM the web
site for as much as I know about the Apache mod_jk connector and its
settings. One notable item is that when the directive JkOptions
+ForwardLocalAddress is in the httpd.conf of the Apache side, then
request.getRemoteHost() and request.getRemoteAddr() return the local
IP address of the server. This coincides with the directive
"HostnameLookups Off" being set correctly as well.

Since other jsp files are working correctly, I am not sure where to go
from here.

Any ideas on this one? I have been muddling with it as time permits
but I need a push in the proper direction since I am holding up the
developer's progress.

- Thanks in advance.

Re: Configuration of Apache with Tomcat

am 10.07.2007 20:34:54 von AMBhatti

I found the answer to this one. It cropped up after noting that the
log files for the VirtualHost were
not properly recording the host IP as well - the %h value.
This is a WinOS specific issue and the fix is as noted below from my
httpd.conf file

# *********
# Modfied: 2007-07-10
# Purpose: Added Win32DisableAcceptEx as recommended by Apache to fix
issue
# with logging files where the "remote" hostname and ip addresses
# were not resolving properly. Fix specific to issues on Win2K and
# not needed for Win2K3 servers.
#
<....>
# After the LogFormat statments
<....>
# This is needed for Windows 2000 and not 2003. Forces this module to
use accept() rather than AcceptEx() to
# accept network connections. This forces the %h type "remote"
logging text to resolve properly.
Win32DisableAcceptEx


I hope this helps others.
=============