user3659442
user3659442

Reputation: 21

block unknown IP Addresses for Apache tomcat

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

Answers (1)

Senthilkumar Ramasamy
Senthilkumar Ramasamy

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

Related Questions