I've got a开发者_JS百科 tomcat6 servlet container which runs various applications, such as solr. I'd like to be able to specify which IP addresses that are allowed to access the server. Is there a way to "globally", for all servlets, to specify which IP adresses that can access any of the servlets?
I solved it by editing the servlet context.xml file. Event though it isn't a "global" solution, it did the track and allows me to filter access by IP address.
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true">
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="[IPADDRESS]"/>
</Context>
精彩评论