tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Gomez <henri.go...@gmail.com>
Subject Re: RemoteIpValve advices
Date Tue, 25 Jan 2011 23:31:24 GMT
> I've got a very basic valve for now to handle this kind of X-Forwarded
> situation :
>
>
> public class ForwardedValve extends ValveBase {
>
>    public void invoke(Request paramRequest, Response paramResponse)
>            throws IOException, ServletException {
>
>        String header = paramRequest.getHeader("X-Forwarded-Host");
>
>        if (header != null)
>            paramRequest.setServerName(header);
>
>        int header1 = paramRequest.getIntHeader("X-Forwarded-Port");
>
>        if (header1 > 0)
>            paramRequest.setServerPort(header1);
>
>        getNext().invoke(paramRequest, paramResponse);
>    }
> }

Any comments about this valve ?

FYI, it's the kind of valve required by a Tomcat behind Amazon AWS
Load Balancer.
I'll detail more later but the current ForwardedValve only handle
remote (browser) information and not the local (server) address.

Cheers.

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


Mime
View raw message