You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nino Ulsamer <ni...@equitystory.de> on 2007/07/02 12:01:10 UTC

Tomcat - Apache: IP replacement

Hello,

I have a problem with finding out the IP address of requests in Tomcat.
I'm using the HttpServletRequest.getRemoteAddr() function, but it
returns "0.0.0.0". My server configuration is as follows: Apache
receives all requests and forwards them to Tomcat via mod_jk. Probably
in this step it replaces the address of the original request by its own
address. I've read a lot about this topic already, but I always found
the solution being "you should use mod_jk". I'm using JK 1.2, is it
possible to configure it so that it does not replace the IP address?

Thanks a lot,

Nino Ulsamer


Re: Tomcat - Apache: IP replacement

Posted by ben short <be...@benshort.co.uk>.
I had an issue where getLocalAddr() would return 127.0.0.1 rather than
the ip address of my linux box. Altering the /etc/hosts file to
something like the following fixed that. I wonder what effect that
might have for your problem.

192.168.6.173           box box.domain.com
127.0.0.1              localhost

On 7/2/07, Rainer Jung <ra...@kippdata.de> wrote:
> Something is wrong with your configuration or box setup.
> request.getRemoteAddr() works for me, it shows the Apache server address
> used by the request.
>
> Regards,
>
> Rainer
>
> Nino Ulsamer wrote:
> > Hello,
> >
> > I have a problem with finding out the IP address of requests in Tomcat.
> > I'm using the HttpServletRequest.getRemoteAddr() function, but it
> > returns "0.0.0.0". My server configuration is as follows: Apache
> > receives all requests and forwards them to Tomcat via mod_jk. Probably
> > in this step it replaces the address of the original request by its own
> > address. I've read a lot about this topic already, but I always found
> > the solution being "you should use mod_jk". I'm using JK 1.2, is it
> > possible to configure it so that it does not replace the IP address?
> >
> > Thanks a lot,
> >
> > Nino Ulsamer
>
> ---------------------------------------------------------------------
> 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


Re: AW: Tomcat - Apache: IP replacement

Posted by Rainer Jung <ra...@kippdata.de>.
I'm sorry, in fact that's what I wanted to tell you. I tested with 
Apache and Tomcat not on the same machine, but with the client on the 
Apache machine. If I move the client to another machine, the result is 
the wanted result, it shows the IP of the client.

I tend to agree with Johnny Kewl, most of the times one notices strange 
IP address behaviour it comes from IPv6. But unfortunately this comment 
doesn't solve your problem :(

Regards,

Rainer

Nino Ulsamer wrote:
> Rainer,
> thanks for your comment. But I don't want to see the Apache server address, I want to see the address of the user who originally started the request!
> Nino
> 
> -----Ursprüngliche Nachricht-----
> Von: Rainer Jung [mailto:rainer.jung@kippdata.de] 
> Gesendet: Montag, 2. Juli 2007 12:22
> An: Tomcat Users List
> Betreff: Re: Tomcat - Apache: IP replacement
> 
> Something is wrong with your configuration or box setup. 
> request.getRemoteAddr() works for me, it shows the Apache server address 
> used by the request.
> 
> Regards,
> 
> Rainer
> 
> Nino Ulsamer wrote:
>> Hello,
>>
>> I have a problem with finding out the IP address of requests in Tomcat.
>> I'm using the HttpServletRequest.getRemoteAddr() function, but it
>> returns "0.0.0.0". My server configuration is as follows: Apache
>> receives all requests and forwards them to Tomcat via mod_jk. Probably
>> in this step it replaces the address of the original request by its own
>> address. I've read a lot about this topic already, but I always found
>> the solution being "you should use mod_jk". I'm using JK 1.2, is it
>> possible to configure it so that it does not replace the IP address?
>>
>> Thanks a lot,
>>
>> Nino Ulsamer

---------------------------------------------------------------------
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


AW: Tomcat - Apache: IP replacement

Posted by Nino Ulsamer <ni...@equitystory.de>.
Rainer,
thanks for your comment. But I don't want to see the Apache server address, I want to see the address of the user who originally started the request!
Nino

-----Ursprüngliche Nachricht-----
Von: Rainer Jung [mailto:rainer.jung@kippdata.de] 
Gesendet: Montag, 2. Juli 2007 12:22
An: Tomcat Users List
Betreff: Re: Tomcat - Apache: IP replacement

Something is wrong with your configuration or box setup. 
request.getRemoteAddr() works for me, it shows the Apache server address 
used by the request.

Regards,

Rainer

Nino Ulsamer wrote:
> Hello,
> 
> I have a problem with finding out the IP address of requests in Tomcat.
> I'm using the HttpServletRequest.getRemoteAddr() function, but it
> returns "0.0.0.0". My server configuration is as follows: Apache
> receives all requests and forwards them to Tomcat via mod_jk. Probably
> in this step it replaces the address of the original request by its own
> address. I've read a lot about this topic already, but I always found
> the solution being "you should use mod_jk". I'm using JK 1.2, is it
> possible to configure it so that it does not replace the IP address?
> 
> Thanks a lot,
> 
> Nino Ulsamer

---------------------------------------------------------------------
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


Re: Tomcat - Apache: IP replacement

Posted by Rainer Jung <ra...@kippdata.de>.
Something is wrong with your configuration or box setup. 
request.getRemoteAddr() works for me, it shows the Apache server address 
used by the request.

Regards,

Rainer

Nino Ulsamer wrote:
> Hello,
> 
> I have a problem with finding out the IP address of requests in Tomcat.
> I'm using the HttpServletRequest.getRemoteAddr() function, but it
> returns "0.0.0.0". My server configuration is as follows: Apache
> receives all requests and forwards them to Tomcat via mod_jk. Probably
> in this step it replaces the address of the original request by its own
> address. I've read a lot about this topic already, but I always found
> the solution being "you should use mod_jk". I'm using JK 1.2, is it
> possible to configure it so that it does not replace the IP address?
> 
> Thanks a lot,
> 
> Nino Ulsamer

---------------------------------------------------------------------
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


AW: Tomcat - Apache: IP replacement

Posted by 吴熊敏 <xw...@ublearning.com>.
On Tue, 3 Jul 2007 17:17:08 +0200
"Nino Ulsamer" <ni...@equitystory.de> wrote:

> Hello,
> 
> I almost couldn't believe it, but I solved the problem. The issue was Apache missing a flag in its config file, Win32DisableAcceptEx. When I put this into the httpd.conf, everything worked fine!
> 
> This crazy stuff took me 2 days to figure out... 
> 
> Does anyone by any chance know what this is doing exactly?? Does it have an impact on performance and/or stability of Apache?
> 
> Regards,
> Nino
> 
> 
> -----Urspr�ngliche Nachricht-----
> Von: Johnny Kewl [mailto:john@kewlstuff.co.za] 
> Gesendet: Dienstag, 3. Juli 2007 16:46
> An: Tomcat Users List
> Betreff: Re: Tomcat - Apache: IP replacement
> 
> 
> ----- Original Message ----- 
> From: "Nino Ulsamer" <ni...@equitystory.de>
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Sent: Tuesday, July 03, 2007 2:25 PM
> Subject: AW: Tomcat - Apache: IP replacement
> 
> 
> 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.
> 
> --------
> Dont know.... if those are established servers, settings are probably OK, 
> only thing I can think of is that JK MOD and Apache.... are a mismatched 
> pair
> mod_jk.so has no versioning info in the file, so its not possible to check 
> it.
> Right click on each httpd.exe file (apache/bin) and check the version.
> Then go to
>  http://apache.mirrors.hoobly.com/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.23/and get the MOD_JK file with the closest number to that Apache version.Replace the mod_jk.so with the matching version, and restart apache...--------Any ideas????Thanks,Nino-----Urspr�ngliche Nachricht-----Von: Johnny Kewl [mailto:john@kewlstuff.co.za]Gesendet: Dienstag, 3. Juli 2007 13:14An: Tomcat Users ListBetreff: Re: Tomcat - Apache: IP replacementHi Nino,Just to make sure my memory served me correctly, I setup a test case forApache -> 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 enabledThe machines name is Animal.... ipv4 10.0.0.4... IPv6 2001:918:0:12:1::2I have a simple webapp that returns the getRemoteAddrTurns 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:1http://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...... ifI remember correctly ;)So IPv6 seems to map it all to the loop back addresshttp://10.0.0.4:8080/TestRemoteIp/   gives Remote IP is 10.0.0.4Thank goodness ;)http://[2001:918:0:12:1::2]:8080/TestRemoteIp/  gives Remote IP is2001:918:0:12:1:0:0:2=== Thru Apache Local Browser===http://localhost/TestRemoteIp/  gives Remote IP is 127.0.0.1It actually fixes it ;)http://animal/TestRemoteIp/  gives Remote IP is 127.0.0.1So with IPv6 the machine name is now mapping to loop back... on IPv4 itwould be 10.0.0.4http://10.0.0.4/TestRemoteIp/  gives Remote IP is 10.0.0.4http://[2001:918:0:12:1::2]/TestRemoteIp/   FAILS expected because thisapache is not IPv6 enabled=== Thru Apache REMOTE machine Browser===When Calling "Animal", or "10.0.0.4".... always gives the correct IPV4address of rem
 ot
>  e machine (which is not IPv6 enabled)So as you can see.... a few things are different on IPV6..... which I nowbelieve you not on ;).... the 0.0.0.0 you getting is just very strangeEven though the little differences will make developers pull their hair out;).... its definitely is working, even on IPv6 and the differences are onlywhen 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.msiand mod_jk-apache-2.2.4.soNOTICE THAT even though JK is now at version JK-1.2.23.... the binary fileyou download must match the version of Apache.as you can see from the notes on this pagehttp://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.propertiesJkLogFile conf/jk/mod_jk.logJkLogLevel info#JkLogLevel debugJkLogStam
 pF
>  ormat "[%a %b %d %H:%M:%S %Y]"JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectoriesJkRequestLogFormat "%w %V %T"JkMount /TestRemoteIp/*  worker1========== WORKERS.Properties ========worker.list=worker1# Set WORKER1worker.worker1.port=8009worker.worker1.host=animalworker.worker1.type=ajp13=============== Test JSP =================<%@page contentType="text/html"%><%@page 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 thestuff again... the above definitely works, and I'm guessing you got a bumfile, or a mismatch between Apache and JK module......Good Luck----- Original Message -----From: "Nino Ulsamer" <ni...@equitystory.de>To: "Tomcat
  U
>  sers List" <us...@tomcat.apache.org>Sent: Monday, July 02, 2007 5:43 PMSubject: AW: Tomcat - Apache: IP replacementHey,thanks for your support so far.I just played around with the settings some more and could find out moreinteresting stuff...First of all, about our configuration: we have an Apache and Tomcat runningon 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), theIP 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 toTomcat:[Mon Jul 02 17:28:36 2007] [0848:1240] [debug] mod_jk.c (604): Serviceprotocol=HTTP/1.1 method=GET host=(null) addr=0.0.0.0 name=xxx.xxx.xxx.xxxport=80 auth=(null) user=(null) laddr=xxx.xxx.xxx.xxx raddr=0.0.0.0So even here, this strange 0.0.0.0 is coming up.One more intersting to notice. From the logfiles I saw that this wholeproblem started when we switched from J
 K 
>  2 to JK 1.2 (which is supposed tobe the newer version).But we are using very basic settings of JK, according to the howto of thewebsite. A single loadbalancer-worker, so nothing special.Any hints???Nino---------------------------------------------------------------------To start a new topic, e-mail: users@tomcat.apache.orgTo unsubscribe, e-mail: users-unsubscribe@tomcat.apache.orgFor additional commands, e-mail: users-help@tomcat.apache.org---------------------------------------------------------------------To start a new topic, e-mail: users@tomcat.apache.orgTo unsubscribe, e-mail: users-unsubscribe@tomcat.apache.orgFor 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
> 
> ---------------------------------------------------------------------
> 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

----------------------------
������ <xw...@ublearning.com>


---------------------------------------------------------------------
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


Re: AW: Tomcat - Apache: IP replacement

Posted by David Delbecq <de...@oma.be>.
from
http://httpd.apache.org/docs/2.2/mod/mpm_winnt.html#win32disableacceptex

AcceptEx() is a Microsoft WinSock v2 API that provides some performance
improvements over the use of the BSD style accept() API in certain
circumstances. Some popular Windows products, typically virus scanning
or virtual private network packages, have bugs that interfere with the
proper operation of AcceptEx(). If you encounter an error condition like:
[error] (730038)An operation was attempted on something that is not a
socket.: winnt_accept: AcceptEx failed. Attempting to recover.
you should use this directive to disable the use of AcceptEx().


En l'instant précis du 04/07/07 10:54, Nino Ulsamer s'exprimait en ces
termes:
> Well, that's really strange, because those servers are basically very clean. No software firewall, antivirus, or something similar. Those are production servers, so they are really running nothing else than MySQL, Apache and Tomcat... SP4 is installed as well.
>
> What exactly is this Win32DisableAcceptEx doing??
>
> Nino
>
> -----Ursprüngliche Nachricht-----
> Von: Johnny Kewl [mailto:john@kewlstuff.co.za] 
> Gesendet: Dienstag, 3. Juli 2007 20:46
> An: Tomcat Users List
> Betreff: Re: Tomcat - Apache: IP replacement
>
> Nino, I'm thrilled that you onto the problem, and that there definitely 
> seems to be a real issue, its not just a config glitch somewhere..... but it 
> doesnt look good.
>
> That command is effectively turning Apache into a steam engine on windows, 
> and its treating windows like its got stone age sockets.... (no comment from 
> linix guys;)
>
> Heres a article.... http://apache.osuosl.org/httpd/binaries/win32/
>
> Listen, I think those machines need a serious upgrade.... suggest you pull 
> off any games, disable the antivirus package you using and get another one, 
> and go get the latest Service Pack from windows...... think SP4 is the last 
> one for Win 2K
>
> Basically.... your win sockets are broken.... I think its a bum 
> antivirus..... or a nasty game.... how you even thought to use that command 
> is beyond me.... well done.
> Think you cracked it bro! ;)
>
>
> ----- Original Message ----- 
> From: "Nino Ulsamer" <ni...@equitystory.de>
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Sent: Tuesday, July 03, 2007 5:17 PM
> Subject: AW: Tomcat - Apache: IP replacement
>
>
> Hello,
>
> I almost couldn't believe it, but I solved the problem. The issue was Apache 
> missing a flag in its config file, Win32DisableAcceptEx. When I put this 
> into the httpd.conf, everything worked fine!
>
> This crazy stuff took me 2 days to figure out...
>
> Does anyone by any chance know what this is doing exactly?? Does it have an 
> impact on performance and/or stability of Apache?
>
> Regards,
> 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
>
>   


---------------------------------------------------------------------
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


AW: Tomcat - Apache: IP replacement

Posted by Nino Ulsamer <ni...@equitystory.de>.
Well, that's really strange, because those servers are basically very clean. No software firewall, antivirus, or something similar. Those are production servers, so they are really running nothing else than MySQL, Apache and Tomcat... SP4 is installed as well.

What exactly is this Win32DisableAcceptEx doing??

Nino

-----Ursprüngliche Nachricht-----
Von: Johnny Kewl [mailto:john@kewlstuff.co.za] 
Gesendet: Dienstag, 3. Juli 2007 20:46
An: Tomcat Users List
Betreff: Re: Tomcat - Apache: IP replacement

Nino, I'm thrilled that you onto the problem, and that there definitely 
seems to be a real issue, its not just a config glitch somewhere..... but it 
doesnt look good.

That command is effectively turning Apache into a steam engine on windows, 
and its treating windows like its got stone age sockets.... (no comment from 
linix guys;)

Heres a article.... http://apache.osuosl.org/httpd/binaries/win32/

Listen, I think those machines need a serious upgrade.... suggest you pull 
off any games, disable the antivirus package you using and get another one, 
and go get the latest Service Pack from windows...... think SP4 is the last 
one for Win 2K

Basically.... your win sockets are broken.... I think its a bum 
antivirus..... or a nasty game.... how you even thought to use that command 
is beyond me.... well done.
Think you cracked it bro! ;)


----- Original Message ----- 
From: "Nino Ulsamer" <ni...@equitystory.de>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, July 03, 2007 5:17 PM
Subject: AW: Tomcat - Apache: IP replacement


Hello,

I almost couldn't believe it, but I solved the problem. The issue was Apache 
missing a flag in its config file, Win32DisableAcceptEx. When I put this 
into the httpd.conf, everything worked fine!

This crazy stuff took me 2 days to figure out...

Does anyone by any chance know what this is doing exactly?? Does it have an 
impact on performance and/or stability of Apache?

Regards,
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


Re: Tomcat - Apache: IP replacement

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Nino, I'm thrilled that you onto the problem, and that there definitely 
seems to be a real issue, its not just a config glitch somewhere..... but it 
doesnt look good.

That command is effectively turning Apache into a steam engine on windows, 
and its treating windows like its got stone age sockets.... (no comment from 
linix guys;)

Heres a article.... http://apache.osuosl.org/httpd/binaries/win32/

Listen, I think those machines need a serious upgrade.... suggest you pull 
off any games, disable the antivirus package you using and get another one, 
and go get the latest Service Pack from windows...... think SP4 is the last 
one for Win 2K

Basically.... your win sockets are broken.... I think its a bum 
antivirus..... or a nasty game.... how you even thought to use that command 
is beyond me.... well done.
Think you cracked it bro! ;)


----- Original Message ----- 
From: "Nino Ulsamer" <ni...@equitystory.de>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, July 03, 2007 5:17 PM
Subject: AW: Tomcat - Apache: IP replacement


Hello,

I almost couldn't believe it, but I solved the problem. The issue was Apache 
missing a flag in its config file, Win32DisableAcceptEx. When I put this 
into the httpd.conf, everything worked fine!

This crazy stuff took me 2 days to figure out...

Does anyone by any chance know what this is doing exactly?? Does it have an 
impact on performance and/or stability of Apache?

Regards,
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


AW: Tomcat - Apache: IP replacement

Posted by Nino Ulsamer <ni...@equitystory.de>.
Hello,

I almost couldn't believe it, but I solved the problem. The issue was Apache missing a flag in its config file, Win32DisableAcceptEx. When I put this into the httpd.conf, everything worked fine!

This crazy stuff took me 2 days to figure out... 

Does anyone by any chance know what this is doing exactly?? Does it have an impact on performance and/or stability of Apache?

Regards,
Nino


-----Ursprüngliche Nachricht-----
Von: Johnny Kewl [mailto:john@kewlstuff.co.za] 
Gesendet: Dienstag, 3. Juli 2007 16:46
An: Tomcat Users List
Betreff: Re: Tomcat - Apache: IP replacement


----- Original Message ----- 
From: "Nino Ulsamer" <ni...@equitystory.de>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, July 03, 2007 2:25 PM
Subject: AW: Tomcat - Apache: IP replacement


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.

--------
Dont know.... if those are established servers, settings are probably OK, 
only thing I can think of is that JK MOD and Apache.... are a mismatched 
pair
mod_jk.so has no versioning info in the file, so its not possible to check 
it.
Right click on each httpd.exe file (apache/bin) and check the version.
Then go to
 http://apache.mirrors.hoobly.com/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.23/and get the MOD_JK file with the closest number to that Apache version.Replace the mod_jk.so with the matching version, and restart apache...--------Any ideas????Thanks,Nino-----Ursprüngliche Nachricht-----Von: Johnny Kewl [mailto:john@kewlstuff.co.za]Gesendet: Dienstag, 3. Juli 2007 13:14An: Tomcat Users ListBetreff: Re: Tomcat - Apache: IP replacementHi Nino,Just to make sure my memory served me correctly, I setup a test case forApache -> 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 enabledThe machines name is Animal.... ipv4 10.0.0.4... IPv6 2001:918:0:12:1::2I have a simple webapp that returns the getRemoteAddrTurns 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:1http://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...... ifI remember correctly ;)So IPv6 seems to map it all to the loop back addresshttp://10.0.0.4:8080/TestRemoteIp/   gives Remote IP is 10.0.0.4Thank goodness ;)http://[2001:918:0:12:1::2]:8080/TestRemoteIp/  gives Remote IP is2001:918:0:12:1:0:0:2=== Thru Apache Local Browser===http://localhost/TestRemoteIp/  gives Remote IP is 127.0.0.1It actually fixes it ;)http://animal/TestRemoteIp/  gives Remote IP is 127.0.0.1So with IPv6 the machine name is now mapping to loop back... on IPv4 itwould be 10.0.0.4http://10.0.0.4/TestRemoteIp/  gives Remote IP is 10.0.0.4http://[2001:918:0:12:1::2]/TestRemoteIp/   FAILS expected because thisapache is not IPv6 enabled=== Thru Apache REMOTE machine Browser===When Calling "Animal", or "10.0.0.4".... always gives the correct IPV4address of remot
 e machine (which is not IPv6 enabled)So as you can see.... a few things are different on IPV6..... which I nowbelieve you not on ;).... the 0.0.0.0 you getting is just very strangeEven though the little differences will make developers pull their hair out;).... its definitely is working, even on IPv6 and the differences are onlywhen 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.msiand mod_jk-apache-2.2.4.soNOTICE THAT even though JK is now at version JK-1.2.23.... the binary fileyou download must match the version of Apache.as you can see from the notes on this pagehttp://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.propertiesJkLogFile conf/jk/mod_jk.logJkLogLevel info#JkLogLevel debugJkLogStampF
 ormat "[%a %b %d %H:%M:%S %Y]"JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectoriesJkRequestLogFormat "%w %V %T"JkMount /TestRemoteIp/*  worker1========== WORKERS.Properties ========worker.list=worker1# Set WORKER1worker.worker1.port=8009worker.worker1.host=animalworker.worker1.type=ajp13=============== Test JSP =================<%@page contentType="text/html"%><%@page 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 thestuff again... the above definitely works, and I'm guessing you got a bumfile, or a mismatch between Apache and JK module......Good Luck----- Original Message -----From: "Nino Ulsamer" <ni...@equitystory.de>To: "Tomcat U
 sers List" <us...@tomcat.apache.org>Sent: Monday, July 02, 2007 5:43 PMSubject: AW: Tomcat - Apache: IP replacementHey,thanks for your support so far.I just played around with the settings some more and could find out moreinteresting stuff...First of all, about our configuration: we have an Apache and Tomcat runningon 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), theIP 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 toTomcat:[Mon Jul 02 17:28:36 2007] [0848:1240] [debug] mod_jk.c (604): Serviceprotocol=HTTP/1.1 method=GET host=(null) addr=0.0.0.0 name=xxx.xxx.xxx.xxxport=80 auth=(null) user=(null) laddr=xxx.xxx.xxx.xxx raddr=0.0.0.0So even here, this strange 0.0.0.0 is coming up.One more intersting to notice. From the logfiles I saw that this wholeproblem started when we switched from JK 
 2 to JK 1.2 (which is supposed tobe the newer version).But we are using very basic settings of JK, according to the howto of thewebsite. A single loadbalancer-worker, so nothing special.Any hints???Nino---------------------------------------------------------------------To start a new topic, e-mail: users@tomcat.apache.orgTo unsubscribe, e-mail: users-unsubscribe@tomcat.apache.orgFor additional commands, e-mail: users-help@tomcat.apache.org---------------------------------------------------------------------To start a new topic, e-mail: users@tomcat.apache.orgTo unsubscribe, e-mail: users-unsubscribe@tomcat.apache.orgFor 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

---------------------------------------------------------------------
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


Re: Tomcat - Apache: IP replacement

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message ----- 
From: "Nino Ulsamer" <ni...@equitystory.de>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, July 03, 2007 2:25 PM
Subject: AW: Tomcat - Apache: IP replacement


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.

--------
Dont know.... if those are established servers, settings are probably OK, 
only thing I can think of is that JK MOD and Apache.... are a mismatched 
pair
mod_jk.so has no versioning info in the file, so its not possible to check 
it.
Right click on each httpd.exe file (apache/bin) and check the version.
Then go to
 http://apache.mirrors.hoobly.com/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.23/and get the MOD_JK file with the closest number to that Apache version.Replace the mod_jk.so with the matching version, and restart apache...--------Any ideas????Thanks,Nino-----Ursprüngliche Nachricht-----Von: Johnny Kewl [mailto:john@kewlstuff.co.za]Gesendet: Dienstag, 3. Juli 2007 13:14An: Tomcat Users ListBetreff: Re: Tomcat - Apache: IP replacementHi Nino,Just to make sure my memory served me correctly, I setup a test case forApache -> 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 enabledThe machines name is Animal.... ipv4 10.0.0.4... IPv6 2001:918:0:12:1::2I have a simple webapp that returns the getRemoteAddrTurns 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:1http://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...... ifI remember correctly ;)So IPv6 seems to map it all to the loop back addresshttp://10.0.0.4:8080/TestRemoteIp/   gives Remote IP is 10.0.0.4Thank goodness ;)http://[2001:918:0:12:1::2]:8080/TestRemoteIp/  gives Remote IP is2001:918:0:12:1:0:0:2=== Thru Apache Local Browser===http://localhost/TestRemoteIp/  gives Remote IP is 127.0.0.1It actually fixes it ;)http://animal/TestRemoteIp/  gives Remote IP is 127.0.0.1So with IPv6 the machine name is now mapping to loop back... on IPv4 itwould be 10.0.0.4http://10.0.0.4/TestRemoteIp/  gives Remote IP is 10.0.0.4http://[2001:918:0:12:1::2]/TestRemoteIp/   FAILS expected because thisapache is not IPv6 enabled=== Thru Apache REMOTE machine Browser===When Calling "Animal", or "10.0.0.4".... always gives the correct IPV4address of remot
 e machine (which is not IPv6 enabled)So as you can see.... a few things are different on IPV6..... which I nowbelieve you not on ;).... the 0.0.0.0 you getting is just very strangeEven though the little differences will make developers pull their hair out;).... its definitely is working, even on IPv6 and the differences are onlywhen 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.msiand mod_jk-apache-2.2.4.soNOTICE THAT even though JK is now at version JK-1.2.23.... the binary fileyou download must match the version of Apache.as you can see from the notes on this pagehttp://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.propertiesJkLogFile conf/jk/mod_jk.logJkLogLevel info#JkLogLevel debugJkLogStampF
 ormat "[%a %b %d %H:%M:%S %Y]"JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectoriesJkRequestLogFormat "%w %V %T"JkMount /TestRemoteIp/*  worker1========== WORKERS.Properties ========worker.list=worker1# Set WORKER1worker.worker1.port=8009worker.worker1.host=animalworker.worker1.type=ajp13=============== Test JSP =================<%@page contentType="text/html"%><%@page 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 thestuff again... the above definitely works, and I'm guessing you got a bumfile, or a mismatch between Apache and JK module......Good Luck----- Original Message -----From: "Nino Ulsamer" <ni...@equitystory.de>To: "Tomcat U
 sers List" <us...@tomcat.apache.org>Sent: Monday, July 02, 2007 5:43 PMSubject: AW: Tomcat - Apache: IP replacementHey,thanks for your support so far.I just played around with the settings some more and could find out moreinteresting stuff...First of all, about our configuration: we have an Apache and Tomcat runningon 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), theIP 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 toTomcat:[Mon Jul 02 17:28:36 2007] [0848:1240] [debug] mod_jk.c (604): Serviceprotocol=HTTP/1.1 method=GET host=(null) addr=0.0.0.0 name=xxx.xxx.xxx.xxxport=80 auth=(null) user=(null) laddr=xxx.xxx.xxx.xxx raddr=0.0.0.0So even here, this strange 0.0.0.0 is coming up.One more intersting to notice. From the logfiles I saw that this wholeproblem started when we switched from JK 
 2 to JK 1.2 (which is supposed tobe the newer version).But we are using very basic settings of JK, according to the howto of thewebsite. A single loadbalancer-worker, so nothing special.Any hints???Nino---------------------------------------------------------------------To start a new topic, e-mail: users@tomcat.apache.orgTo unsubscribe, e-mail: users-unsubscribe@tomcat.apache.orgFor additional commands, e-mail: users-help@tomcat.apache.org---------------------------------------------------------------------To start a new topic, e-mail: users@tomcat.apache.orgTo unsubscribe, e-mail: users-unsubscribe@tomcat.apache.orgFor 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


AW: Tomcat - Apache: IP replacement

Posted by Nino Ulsamer <ni...@equitystory.de>.
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üngliche Nachricht-----
Von: Johnny Kewl [mailto:john@kewlstuff.co.za] 
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...

==== 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 =================

<%@page contentType="text/html"%>
<%@page 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" <ni...@equitystory.de>
To: "Tomcat Users List" <us...@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: 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


Re: Tomcat - Apache: IP replacement

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
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 =================

<%@page contentType="text/html"%>
<%@page 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" <ni...@equitystory.de>
To: "Tomcat Users List" <us...@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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


AW: Tomcat - Apache: IP replacement

Posted by Nino Ulsamer <ni...@equitystory.de>.
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


-----Ursprüngliche Nachricht-----
Von: Johnny Kewl [mailto:john@kewlstuff.co.za] 
Gesendet: Montag, 2. Juli 2007 14:59
An: Tomcat Users List
Betreff: Re: Tomcat - Apache: IP replacement


----- Original Message ----- 
From: "Nino Ulsamer" <ni...@equitystory.de>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Monday, July 02, 2007 1:43 PM
Subject: AW: Tomcat - Apache: IP replacement


John,
keep cool ;-)
So that might be interesting. We indeed have a MS Box running here, so where 
exactly could we come across IPv6?
---
Its just that I noted that when I only had ipv4 installed, and called it 
from local browser
getRemoteAddr would return 127.0.0.1..... but when I had IPv6 installed, it 
would return 0.0.0.0

So... I'm guessing that IPv6 is installed on that machine...
I dont have VISTA, but there I think its a default, on XP you have to make 
it happen, and its tricky.

And I'm thinking that if Apache is not on the same machine as TC.... getting 
0.0.0.0 is actually impossible, even if it was picking up on the Apache 
server.
I dont think a loop back address can call anything but the machine.
Perhaps if Apache and JK and all the rest are on the same machine, and setup 
on localhost.... that result could in fact be right.
Anyway.... this is all wild guesses

I think if you explain the configuration a little more, and maybe show the 
snippets of configuration files, a guru may spot it.
For example if you calling the Apache box, but the browser is on the same 
machine as TC, then I would guess, its not actually going thru Apache, and 
its getting in thru another connecter.... something like that.

If u interested in IPv6.... heres an article from when the TC guys where 
messing around with it... http://www.junlu.com/msg/354211.html
---




Thanks,
Nino


-----Ursprüngliche Nachricht-----
Von: Johnny Kewl [mailto:john@kewlstuff.co.za]
Gesendet: Montag, 2. Juli 2007 13:21
An: Tomcat Users List
Betreff: Re: Tomcat - Apache: IP replacement

Ha ha.... you made me panic, no my load sharing stuff behind JK, is not
doing that, ie getRemoteAddr is working.
You know if you on a MS box, (guessing wildly here), the first time I ever
saw 0.0.0.0 as a local address is when I was playing with IPv6.....
and only on the "local" IPV6 addresses, maybe?
Anyway if its any concillation.... I dont think JK->TC, does that normally.

----- Original Message ----- 
From: "Nino Ulsamer" <ni...@equitystory.de>
To: <us...@tomcat.apache.org>
Sent: Monday, July 02, 2007 12:01 PM
Subject: Tomcat - Apache: IP replacement


Hello,

I have a problem with finding out the IP address of requests in Tomcat.
I'm using the HttpServletRequest.getRemoteAddr() function, but it
returns "0.0.0.0". My server configuration is as follows: Apache
receives all requests and forwards them to Tomcat via mod_jk. Probably
in this step it replaces the address of the original request by its own
address. I've read a lot about this topic already, but I always found
the solution being "you should use mod_jk". I'm using JK 1.2, is it
possible to configure it so that it does not replace the IP address?

Thanks a lot,

Nino Ulsamer



---------------------------------------------------------------------
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



---------------------------------------------------------------------
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


Re: Tomcat - Apache: IP replacement

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message ----- 
From: "Nino Ulsamer" <ni...@equitystory.de>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Monday, July 02, 2007 1:43 PM
Subject: AW: Tomcat - Apache: IP replacement


John,
keep cool ;-)
So that might be interesting. We indeed have a MS Box running here, so where 
exactly could we come across IPv6?
---
Its just that I noted that when I only had ipv4 installed, and called it 
from local browser
getRemoteAddr would return 127.0.0.1..... but when I had IPv6 installed, it 
would return 0.0.0.0

So... I'm guessing that IPv6 is installed on that machine...
I dont have VISTA, but there I think its a default, on XP you have to make 
it happen, and its tricky.

And I'm thinking that if Apache is not on the same machine as TC.... getting 
0.0.0.0 is actually impossible, even if it was picking up on the Apache 
server.
I dont think a loop back address can call anything but the machine.
Perhaps if Apache and JK and all the rest are on the same machine, and setup 
on localhost.... that result could in fact be right.
Anyway.... this is all wild guesses

I think if you explain the configuration a little more, and maybe show the 
snippets of configuration files, a guru may spot it.
For example if you calling the Apache box, but the browser is on the same 
machine as TC, then I would guess, its not actually going thru Apache, and 
its getting in thru another connecter.... something like that.

If u interested in IPv6.... heres an article from when the TC guys where 
messing around with it... http://www.junlu.com/msg/354211.html
---




Thanks,
Nino


-----Ursprüngliche Nachricht-----
Von: Johnny Kewl [mailto:john@kewlstuff.co.za]
Gesendet: Montag, 2. Juli 2007 13:21
An: Tomcat Users List
Betreff: Re: Tomcat - Apache: IP replacement

Ha ha.... you made me panic, no my load sharing stuff behind JK, is not
doing that, ie getRemoteAddr is working.
You know if you on a MS box, (guessing wildly here), the first time I ever
saw 0.0.0.0 as a local address is when I was playing with IPv6.....
and only on the "local" IPV6 addresses, maybe?
Anyway if its any concillation.... I dont think JK->TC, does that normally.

----- Original Message ----- 
From: "Nino Ulsamer" <ni...@equitystory.de>
To: <us...@tomcat.apache.org>
Sent: Monday, July 02, 2007 12:01 PM
Subject: Tomcat - Apache: IP replacement


Hello,

I have a problem with finding out the IP address of requests in Tomcat.
I'm using the HttpServletRequest.getRemoteAddr() function, but it
returns "0.0.0.0". My server configuration is as follows: Apache
receives all requests and forwards them to Tomcat via mod_jk. Probably
in this step it replaces the address of the original request by its own
address. I've read a lot about this topic already, but I always found
the solution being "you should use mod_jk". I'm using JK 1.2, is it
possible to configure it so that it does not replace the IP address?

Thanks a lot,

Nino Ulsamer



---------------------------------------------------------------------
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



---------------------------------------------------------------------
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


AW: Tomcat - Apache: IP replacement

Posted by Nino Ulsamer <ni...@equitystory.de>.
John,
keep cool ;-)
So that might be interesting. We indeed have a MS Box running here, so where exactly could we come across IPv6?
Thanks,
Nino


-----Ursprüngliche Nachricht-----
Von: Johnny Kewl [mailto:john@kewlstuff.co.za] 
Gesendet: Montag, 2. Juli 2007 13:21
An: Tomcat Users List
Betreff: Re: Tomcat - Apache: IP replacement

Ha ha.... you made me panic, no my load sharing stuff behind JK, is not 
doing that, ie getRemoteAddr is working.
You know if you on a MS box, (guessing wildly here), the first time I ever 
saw 0.0.0.0 as a local address is when I was playing with IPv6.....
and only on the "local" IPV6 addresses, maybe?
Anyway if its any concillation.... I dont think JK->TC, does that normally.

----- Original Message ----- 
From: "Nino Ulsamer" <ni...@equitystory.de>
To: <us...@tomcat.apache.org>
Sent: Monday, July 02, 2007 12:01 PM
Subject: Tomcat - Apache: IP replacement


Hello,

I have a problem with finding out the IP address of requests in Tomcat.
I'm using the HttpServletRequest.getRemoteAddr() function, but it
returns "0.0.0.0". My server configuration is as follows: Apache
receives all requests and forwards them to Tomcat via mod_jk. Probably
in this step it replaces the address of the original request by its own
address. I've read a lot about this topic already, but I always found
the solution being "you should use mod_jk". I'm using JK 1.2, is it
possible to configure it so that it does not replace the IP address?

Thanks a lot,

Nino Ulsamer



---------------------------------------------------------------------
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


Re: Tomcat - Apache: IP replacement

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Ha ha.... you made me panic, no my load sharing stuff behind JK, is not 
doing that, ie getRemoteAddr is working.
You know if you on a MS box, (guessing wildly here), the first time I ever 
saw 0.0.0.0 as a local address is when I was playing with IPv6.....
and only on the "local" IPV6 addresses, maybe?
Anyway if its any concillation.... I dont think JK->TC, does that normally.

----- Original Message ----- 
From: "Nino Ulsamer" <ni...@equitystory.de>
To: <us...@tomcat.apache.org>
Sent: Monday, July 02, 2007 12:01 PM
Subject: Tomcat - Apache: IP replacement


Hello,

I have a problem with finding out the IP address of requests in Tomcat.
I'm using the HttpServletRequest.getRemoteAddr() function, but it
returns "0.0.0.0". My server configuration is as follows: Apache
receives all requests and forwards them to Tomcat via mod_jk. Probably
in this step it replaces the address of the original request by its own
address. I've read a lot about this topic already, but I always found
the solution being "you should use mod_jk". I'm using JK 1.2, is it
possible to configure it so that it does not replace the IP address?

Thanks a lot,

Nino Ulsamer



---------------------------------------------------------------------
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