You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alexander Khoo <al...@yahoo.com> on 2006/09/22 06:44:34 UTC

Client Real Source IP!

Dear All,

We currently have Tomcat Version5 install behind Pound reverse proxy! Our code cant identify the real source client IP instead the reverse proxy IP everytime, We understand Pound adds the X-Forwarded-for header with the original client address to every request....but how we can identify it?


Please Help!
Alexander Khoo

Re: Client Real Source IP!

Posted by Alexander Khoo <al...@yahoo.com>.
Thanks for the information,Anyone can provide more detail on how this can be done? how the code is done perhaps?


----- Original Message ----
From: Li <am...@gmail.com>
To: Tomcat Users List <us...@tomcat.apache.org>
Sent: Friday, September 22, 2006 1:42:14 PM
Subject: Re: Client Real Source IP!


Sorry Alexander,

Yeah, as Peter said, you can use getHeader(s) from Servlet API. Only if your
request header is customized one (like those for telecom), you should read
it by yourself.



On 9/22/06, Peter Rossbach <pr...@objektpark.de> wrote:
>
> You can access the header with ServletRequest.getHeader, getHeaders,
> getHeadersNames.
>
> Read Servlet Spec 2.4 or 2.5 Headers 4.3
>
>
> Wrote your own Valve or ServletFilter ....
>
> Regards
> Peter
>
>
> Am 22.09.2006 um 06:44 schrieb Alexander Khoo:
>
> > Dear All,
> >
> > We currently have Tomcat Version5 install behind Pound reverse
> > proxy! Our code cant identify the real source client IP instead the
> > reverse proxy IP everytime, We understand Pound adds the X-
> > Forwarded-for header with the original client address to every
> > request....but how we can identify it?
> >
> >
> > Please Help!
> > Alexander Khoo
>
>
>


-- 
When we invent time, we invent death.

Re: Client Real Source IP!

Posted by Li <am...@gmail.com>.
Sorry Alexander,

Yeah, as Peter said, you can use getHeader(s) from Servlet API. Only if your
request header is customized one (like those for telecom), you should read
it by yourself.



On 9/22/06, Peter Rossbach <pr...@objektpark.de> wrote:
>
> You can access the header with ServletRequest.getHeader, getHeaders,
> getHeadersNames.
>
> Read Servlet Spec 2.4 or 2.5 Headers 4.3
>
>
> Wrote your own Valve or ServletFilter ....
>
> Regards
> Peter
>
>
> Am 22.09.2006 um 06:44 schrieb Alexander Khoo:
>
> > Dear All,
> >
> > We currently have Tomcat Version5 install behind Pound reverse
> > proxy! Our code cant identify the real source client IP instead the
> > reverse proxy IP everytime, We understand Pound adds the X-
> > Forwarded-for header with the original client address to every
> > request....but how we can identify it?
> >
> >
> > Please Help!
> > Alexander Khoo
>
>
>


-- 
When we invent time, we invent death.

Re: Client Real Source IP!

Posted by Peter Rossbach <pr...@objektpark.de>.
You can access the header with ServletRequest.getHeader, getHeaders,  
getHeadersNames.

Read Servlet Spec 2.4 or 2.5 Headers 4.3


Wrote your own Valve or ServletFilter ....

Regards
Peter


Am 22.09.2006 um 06:44 schrieb Alexander Khoo:

> Dear All,
>
> We currently have Tomcat Version5 install behind Pound reverse  
> proxy! Our code cant identify the real source client IP instead the  
> reverse proxy IP everytime, We understand Pound adds the X- 
> Forwarded-for header with the original client address to every  
> request....but how we can identify it?
>
>
> Please Help!
> Alexander Khoo


Re: Client Real Source IP!

Posted by Li <am...@gmail.com>.
Hi,

You need create your own request proecessor to retrieve it. You may have to
get http request full length header first and lookup your request header
structure and read block by block from the header. A better way is to take a
look at few headers and see if the block you need is always after which
block and what is the length.

Normally if adding extra info into header, the reserved blocks should be
appeared before the extra info.

Wish it helps

On 9/22/06, Alexander Khoo <al...@yahoo.com> wrote:
>
> Dear All,
>
> We currently have Tomcat Version5 install behind Pound reverse proxy! Our
> code cant identify the real source client IP instead the reverse proxy IP
> everytime, We understand Pound adds the X-Forwarded-for header with the
> original client address to every request....but how we can identify it?
>
>
> Please Help!
> Alexander Khoo
>



-- 
When we invent time, we invent death.