Hi Nino,
Just to make sure my memory served me correctly, I setup a test case for
Apache -> JK -> TC.... on a machine (XP SP2) with IPV6 enabled.
Apache, Browser and TC... are all on same machine to simulate your test.
Apache is not IPv6 enabled
The machines name is Animal.... ipv4 10.0.0.4... IPv6 2001:918:0:12:1::2
I have a simple webapp that returns the getRemoteAddr
Turns out I was close, but my memory is actually crap ;)
This is what happens...
==== Direct to TC Local Browser===
http://localhost:8080/TestRemoteIp/ gives Remote IP is 0:0:0:0:0:0:0:1
http://animal:8080/TestRemoteIp/ gives Remote IP is 0:0:0:0:0:0:0:1
(See my memory sucks.... I remembered that as 0.0.0.0)
This is different from IPv4.... normally that will return 10.0.0.4...... if
I remember correctly ;)
So IPv6 seems to map it all to the loop back address
http://10.0.0.4:8080/TestRemoteIp/ gives Remote IP is 10.0.0.4
Thank goodness ;)
http://[2001:918:0:12:1::2]:8080/TestRemoteIp/ gives Remote IP is
2001:918:0:12:1:0:0:2
=== Thru Apache Local Browser===
http://localhost/TestRemoteIp/ gives Remote IP is 127.0.0.1
It actually fixes it ;)
http://animal/TestRemoteIp/ gives Remote IP is 127.0.0.1
So with IPv6 the machine name is now mapping to loop back... on IPv4 it
would be 10.0.0.4
http://10.0.0.4/TestRemoteIp/ gives Remote IP is 10.0.0.4
http://[2001:918:0:12:1::2]/TestRemoteIp/ FAILS expected because this
apache is not IPv6 enabled
=== Thru Apache REMOTE machine Browser===
When Calling "Animal", or "10.0.0.4".... always gives the correct IPV4
address of remote machine (which is not IPv6 enabled)
So as you can see.... a few things are different on IPV6..... which I now
believe you not on ;).... the 0.0.0.0 you getting is just very strange
Even though the little differences will make developers pull their hair out
;).... its definitely is working, even on IPv6 and the differences are only
when testing from a local browser.
Just to make sure.... I downloaded Apache and Mod_JK again for the test....
Used Apache apache_2.2.4-win32-x86-no_ssl.msi
and mod_jk-apache-2.2.4.so
NOTICE THAT even though JK is now at version JK-1.2.23.... the binary file
you download must match the version of Apache.
as you can see from the notes on this page
http://apache.mirrors.hoobly.com/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.23/
======= MOD_JK.conf ========
<IfModule !mod_jk.c>
LoadModule jk_module "D:/DEV/Apache2.2.4/modules/mod_jk.so"
</IfModule>
JkWorkersFile conf/jk/workers.properties
JkLogFile conf/jk/mod_jk.log
JkLogLevel info
#JkLogLevel debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /TestRemoteIp/* worker1
========== WORKERS.Properties ========
worker.list=worker1
# Set WORKER1
worker.worker1.port=8009
worker.worker1.host=animal
worker.worker1.type=ajp13
=============== Test JSP =================
<[EMAIL PROTECTED] contentType="text/html"%>
<[EMAIL PROTECTED] pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>TEST getRemoteAddr</title>
</head>
<body>
<h1>TEST getRemoteAddr</h1>
<%
String callerIP = request.getRemoteAddr();
%>
<p>Remote IP is <%=callerIP%></p>
</body>
</html>
I couldnt simulate what you getting.... can only suggest you download the
stuff again... the above definitely works, and I'm guessing you got a bum
file, or a mismatch between Apache and JK module......
Good Luck
----- Original Message -----
From: "Nino Ulsamer" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Monday, July 02, 2007 5:43 PM
Subject: AW: Tomcat - Apache: IP replacement
Hey,
thanks for your support so far.
I just played around with the settings some more and could find out more
interesting stuff...
First of all, about our configuration: we have an Apache and Tomcat running
on the same machine, with JK 1.2 in between. If I log requests in Apache,
the IP address is correct. If I go directly to Tomcat (via port 8080), the
IP is correct. But if I go through JK, the address gets changed to 0.0.0.0.
I checked the JK log file, and it logs the following before forwarding to
Tomcat:
[Mon Jul 02 17:28:36 2007] [0848:1240] [debug] mod_jk.c (604): Service
protocol=HTTP/1.1 method=GET host=(null) addr=0.0.0.0 name=xxx.xxx.xxx.xxx
port=80 auth=(null) user=(null) laddr=xxx.xxx.xxx.xxx raddr=0.0.0.0
So even here, this strange 0.0.0.0 is coming up.
One more intersting to notice. From the logfiles I saw that this whole
problem started when we switched from JK 2 to JK 1.2 (which is supposed to
be the newer version).
But we are using very basic settings of JK, according to the howto of the
website. A single loadbalancer-worker, so nothing special.
Any hints???
Nino
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]