tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Block urls using X-forwaed-for
Date Tue, 16 Feb 2016 14:40:46 GMT
Dave,

On 2/15/16 12:31 PM, Dave Fisher wrote:
> You can take the source code for RemoteIPFilter and have it look at the X-Forwarded-For
header.
> 
> Even better offer a patch to RemoteIPFilter to allow the header field name to be configured.

> 
> You are not the only one with this use case.

Even better, just read the documentation. No patch is required, and
anyone with this use case can use the out-of-the-box component.

http://tomcat.apache.org/tomcat-8.0-doc/config/filter.html#Remote_IP_Filter/Initialisation_parameters

-chris

>> On Feb 15, 2016, at 7:07 AM, André Warnier (tomcat) <aw@ice-sa.com> wrote:
>>
>>> On 15.02.2016 13:03, Dhanushka Parakrama wrote:
>>> Hi Guys
>>>
>>> I have a Tomcat instance behind the load balancer (LB) , LB will pass the
>>> client ip address to backed tomcat instance using *X-forward-for*  header .
>>>
>>> I basically want to filter user traffic based on the *X-forwaed-for* header
>>> in tomcat instance
>>>
>>> i have configured the following filter in tomcat , but it not working
>>>
>>>
>>> <filter>
>>>     <filter-name>Remote Address Filter</filter-name>
>>>     <filter-class>org.apache.catalina.filters.RemoteIpFilter</filter-class>
>>>         <init-param>
>>>             <param-name>allow</param-name>
>>>
>>> <param-value>localhost|205\.97\.96\.\d+|::1|0:0:0:0:0:0:0:1</param-value>
>>>         </init-param>
>>> </filter>
>>>
>>> <filter-mapping>
>>>     <filter-name>Remote Address Filter</filter-name>
>>>     <url-pattern>/mgt/*</url-pattern>
>>> </filter-mapping>
>>>
>>>
>>> Do you guys have any advice how to achieve it .
>>
>> Maybe have a look at : http://tuckey.org/urlrewrite/ ?
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 

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


Mime
View raw message