You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Eric Robinson <er...@psmnv.com> on 2015/07/15 01:24:07 UTC

Make Filter Exception Based on Subnet

Our canned tomcat application's web.xml file contains the following filter...

<filter>
        <filter-name>SessionFilter</filter-name>
        <filter-class>servlet.BlahSession</filter-class>
</filter>

<filter-mapping>
        <filter-name>SessionFilter</filter-name>
        <url-pattern>/*</url-pattern>
</filter-mapping>


Is there a way to make this filter not apply to requests that originate from certain IP addresses?

--
Eric Robinson


Re: Make Filter Exception Based on Subnet

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Eric,

On 7/14/15 6:24 PM, Eric Robinson wrote:
> Our canned tomcat application's web.xml file contains the following
> filter...
> 
> <filter> <filter-name>SessionFilter</filter-name> 
> <filter-class>servlet.BlahSession</filter-class> </filter>
> 
> <filter-mapping> <filter-name>SessionFilter</filter-name> 
> <url-pattern>/*</url-pattern> </filter-mapping>
> 
> 
> Is there a way to make this filter not apply to requests that 
> originate from certain IP addresses?

You can't configure it out of the Filter chain, but you can certainly
modify the code for SessionFilter to ignore requests from (or, rather,
pass-through requests from) those IP addresses.

Another option would be to change SessionFilter to a pass-through if
some special request attribute is present, and then create another
Filter that sets that request attribute for whatever reason you see
fit. That makes the whole system more flexible because you can add
different Filters for different criteria: if you decide that any
"admin" user should be a pass-through, you can do that with yet
another Filter and leave everything in-place.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJVpdMlAAoJEBzwKT+lPKRYAGUP/j847jEBjvE/ZMVGkc4a/di3
1mfgEmDxeTJvniluy/6aoUz82qyhXeb8W++nvOuXI4zyStj82VI4jb6c1K5qB1HF
ix3PYXiV/Xw7xTMrOwMeaoxNwMxGTPJTe8q4fredTZt5YFpqAlEuXYR6qHsA8+II
SQrU8jQ+iuO9uD8OVG7mO3e7zk2MncYMELDG9mNPdyLJXmZT7z+CNYFPC+E2CHzD
g4sp9bqYYUjo7ybZIr0bCNJChfc3fqVIFMi6kU3rxWFs+FXyB04agxTxnWqJKbh9
jjhV86Xia9iZ5SAQ6AhPjZ0FFR6XAPJ1vislo9UB6/5LW3SBCfPyiGBEfz89uDd2
rKiYwY2f6/3hgFN2nX8AZTDnvQZ6+rHpCIzp9X8NJ/Wa/3gHCXzm3KssUFrB/5gf
3LCUaQp9N6vp/k3t9yTd87uqrVN8Hr5SjmrRl2X8UfAaOaKZhR6792gKir59oU0v
6CoFphbK6owkW7uUpK/YEVVmHV6dstoewS5EudnFJc+hLhIzri1gc2Nd/CvYZtt2
Dd6Vpzj6VVxvJUIiz7P4KWVRUf/kmt1BSA614VZB4OFTqMkpzxw1okfV7XfFEHKB
jFcge4aVyUOWpGjfcfBk+qh899ZiEOU8FSVi88pgAj66Box0BjJtzsa72OWRUoWq
PSYkrCMqLfpEzhyiReI8
=iaKg
-----END PGP SIGNATURE-----

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