tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyrille Le Clerc <clecl...@xebia.fr>
Subject Re: Cannot set remote address in valve (Tomcat 5.5)
Date Sun, 11 Oct 2009 10:54:01 GMT
   Hello,

   I updated issue 47330 " proposal : port of mod_remoteip in Tomcat
as RemoteIpValve" to link to a Servlet Filter implementation of
mod_remoteip called XForwardedFilter. As detailed in the comment,
XForwardedFilter.java copyright may not fit the Apache Software
Foundation requirements as it is granted to "The original author or
authors ..." but it can be changed with pleasure.

   Hope this helps,

   Cyrille
--
Cyrille Le Clerc
cleclerc@xebia.fr cyrille@cyrilleleclerc.com
http://blog.xebia.fr

On Sun, Sep 27, 2009 at 11:13 AM, Mark Thomas <markt@apache.org> wrote:
>
> Elli Albek wrote:
> > Hi,
> > We have Tomcat behind a load balancer. The servlet API and tomcat libraries
> > see the load balancer IP as the client IP.
> >
> > I tried to write a simple valve which will extract the IP from HTTP header
> > X-Forwarded-For
> > and continue the valve chain using this IP as the client IP. This will be
> > the first valve in the chain, so everything will work as normal afterwards
> > including log files, IP filter valve, etc.
> >
> > The problem I am facing, is when I try to set the remote IP on the request
> > from my valve, the code does nothing. This is the set method in the class
> > org.apache.catalina.connector.Request:
> >
> >     public void setRemoteAddr(String remoteAddr) {
> >         // Not used
> >     }
> >
> > The variable is protected so I cannot access it directly from my code.
> >
> > Is there any way to implement this Valve?
> >
> > Is there anything already shipped in tomcat to extract the client IP from
> > the header?
> >
> > I DO NOT want to write a servlet filter for various reasons, so I hope there
> > is a way to do it with a valve.
>
> https://issues.apache.org/bugzilla/show_bug.cgi?id=47330 is on the todo
> list but my current plan is to implement it as a Filter rather than a valve.
>
> What is the issue with using a Filter?
>
> If you really want to write a filter than that bug report should be all
> you need.
>
> Mark
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message