Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restrict access by IP address with Tomcat?

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

like image 937
SMSM Avatar asked Aug 01 '10 09:08

SMSM


People also ask

Is it possible to block certain IP addresses in Tomcat?

Thanks for pointing to the great source! Oh by the way (for everyone trying this method), you have to restart your Tomcat instance for the IP restriction to take effect. Futhermore, you can replace deny by allow to only allow certain IP's rather than only blocking certain IP's.

How do I restrict access to IP?

To restrict login for all users, complete the following steps: Click Restrict login by IP, then click Global restrictions tab . Enter the global IP address ranges (in CIDR notation) in the Restrict global login to allowed IP range field. Click Save configuration.

How do I access Tomcat locally?

You need to make Tomcat listen to 192.168. 1.100 address also. If you want it to listen to all interfaces (IP-s) just remove "address=" from Connector string in your configuration file and restart Tomcat.


1 Answers

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

like image 71
skaffman Avatar answered Sep 25 '22 01:09

skaffman