Reputation: 21
How can i restrict unknown IP addresses for accessing my apache tomcat server.(Allow only one ip address and restrict all requests from other ip addresses)?
Upvotes: 2
Views: 1485
Reputation: 101
To block special IP addresses you can put the following in a .htaccess file located in your directory, For Apache Server
order allow,deny
allow from 10.20.30.40
deny from All
For Tomcat Server
<Context path="/path/to/secret_files" ...>
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127.0.0.1" deny=""/>
</Context>
Reference link http://oreilly.com/pub/a/java/archive/tomcat-tips.html?page=2
Upvotes: 3