Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 82812 invoked from network); 3 Jul 2007 12:26:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Jul 2007 12:26:15 -0000 Received: (qmail 86010 invoked by uid 500); 3 Jul 2007 12:26:02 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 85723 invoked by uid 500); 3 Jul 2007 12:26:01 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 85711 invoked by uid 99); 3 Jul 2007 12:26:01 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jul 2007 05:26:01 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [62.245.147.205] (HELO mailserver2003.equitystory.local) (62.245.147.205) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Jul 2007 05:25:55 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: AW: Tomcat - Apache: IP replacement Date: Tue, 3 Jul 2007 14:25:32 +0200 Message-ID: <7E68667569F8F24AA9A89D8A0E7D872E4512C9@mailserver2003.equitystory.local> In-Reply-To: <003301c7bd63$40c6c990$0400000a@animal> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Tomcat - Apache: IP replacement Thread-Index: Ace9Y1AIcoTr7fGpShW1uf0h/NmqmQACYvRA From: "Nino Ulsamer" To: "Tomcat Users List" X-Virus-Checked: Checked by ClamAV on apache.org Hi, thanks for your help! I now tried the following: I set up the configuration as you told me on = my local machine (running Windows XP) and everything works like expected = (getting some IP-address), like you described. If, however, I move to one of our servers (I tried two different servers = now), both running a Windows 2000 Server operating system, I get the = 0.0.0.0 IP, using exactly the same configuration as on my local machine. Any ideas???? Thanks, Nino -----Urspr=FCngliche Nachricht----- Von: Johnny Kewl [mailto:john@kewlstuff.co.za]=20 Gesendet: Dienstag, 3. Juli 2007 13:14 An: Tomcat Users List Betreff: Re: Tomcat - Apache: IP replacement 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... =3D=3D=3D=3D Direct to TC Local Browser=3D=3D=3D 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=20 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=20 2001:918:0:12:1:0:0:2 =3D=3D=3D Thru Apache Local Browser=3D=3D=3D 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=20 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=20 apache is not IPv6 enabled =3D=3D=3D Thru Apache REMOTE machine Browser=3D=3D=3D When Calling "Animal", or "10.0.0.4".... always gives the correct IPV4=20 address of remote machine (which is not IPv6 enabled) So as you can see.... a few things are different on IPV6..... which I = now=20 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=20 ;).... its definitely is working, even on IPv6 and the differences are = only=20 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=20 you download must match the version of Apache. as you can see from the notes on this page=20 http://apache.mirrors.hoobly.com/tomcat/tomcat-connectors/jk/binaries/win= 32/jk-1.2.23/ =3D=3D=3D=3D=3D=3D=3D MOD_JK.conf =3D=3D=3D=3D=3D=3D=3D=3D LoadModule jk_module "D:/DEV/Apache2.2.4/modules/mod_jk.so" 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D WORKERS.Properties = =3D=3D=3D=3D=3D=3D=3D=3D worker.list=3Dworker1 # Set WORKER1 worker.worker1.port=3D8009 worker.worker1.host=3Danimal worker.worker1.type=3Dajp13 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Test JSP = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D <%@page contentType=3D"text/html"%> <%@page pageEncoding=3D"UTF-8"%> TEST getRemoteAddr

TEST getRemoteAddr

<% String callerIP =3D request.getRemoteAddr(); %>

Remote IP is <%=3DcallerIP%>

I couldnt simulate what you getting.... can only suggest you download = the=20 stuff again... the above definitely works, and I'm guessing you got a = bum=20 file, or a mismatch between Apache and JK module...... Good Luck ----- Original Message -----=20 From: "Nino Ulsamer" To: "Tomcat Users List" 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=20 on the same machine, with JK 1.2 in between. If I log requests in = Apache,=20 the IP address is correct. If I go directly to Tomcat (via port 8080), = the=20 IP is correct. But if I go through JK, the address gets changed to = 0.0.0.0.=20 I checked the JK log file, and it logs the following before forwarding = to=20 Tomcat: [Mon Jul 02 17:28:36 2007] [0848:1240] [debug] mod_jk.c (604): Service=20 protocol=3DHTTP/1.1 method=3DGET host=3D(null) addr=3D0.0.0.0 = name=3Dxxx.xxx.xxx.xxx=20 port=3D80 auth=3D(null) user=3D(null) laddr=3Dxxx.xxx.xxx.xxx = raddr=3D0.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=20 problem started when we switched from JK 2 to JK 1.2 (which is supposed = to=20 be the newer version). But we are using very basic settings of JK, according to the howto of = the=20 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: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org