Does anyone know if Tomcat can restrict access to certain application by IP address (like Apache's .htaccess)?
Does anyone know if Tomcat can restrict access to certain application by IP address (like Apache's .htaccess)?
To set up access restriction to your web-application for the certain IP addresses, add the following strings to /opt/tomcat/webapps/{web-application name}/META-INF/context.xml file:
<Context antiJARLocking="true" path="/">
<Valve className="org.apache.catalina.valves.RemoteIpValve" />
<Valve className="org.apache.catalina.valves.RemoteAddrValve" deny="{IP_address}" />
</Context>
Here is the instruction how to do this via Jelastic panel. Be sure to restart your Tomcat for the changes to take effect.
in Tomcat 9,you can configure it in path:apache-tomcat-9.0.14\webapps\manager\META-INF\context.xml