How to restrict access by IP address with Tomcat?

SMSM picture SMSM · Aug 1, 2010 · Viewed 64.4k times · Source

Does anyone know if Tomcat can restrict access to certain application by IP address (like Apache's .htaccess)?

Answer

skaffman picture skaffman · Aug 1, 2010

You add a Valve to the Context in context.xml (specifically, org.apache.catalina.valves.RemoteAddrValve). See the docs on Remote Host Filters.