Is there a way to restrict/allow access to a specific file on Tomcat only to certain IPs? If there is no direct way to do this, what would be a good workaround?
I'd really appreciate your help.
Is there a way to restrict/allow access to a specific file on Tomcat only to certain IPs? If there is no direct way to do this, what would be a good workaround?
I'd really appreciate your help.
There is a way to do so with Tomcat ;)
Code:
<Context path="/here is youre path to the files">
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="here u put the IP addresses you want to allow" deny="here u put the IP addresses you want to deny"/>
</Context>
I highly recommend you to read the Tomcat Tips which have been published by O´reilly. Can be found here.
Number 10 on there Site is about your Question
EDIT: This has to be pasted to your Server.xml
EDIT1: OTHER Way can be found here Tomcat Valve settings
There are various ways to do it, depending on exactly what you want to do. For example:
Or if you wanted something fine-grained (e.g. pattern matching on the path part of the request URL) then you could implement your own Filter class.