samedi 29 octobre 2016

Tomcat Web Application: Allow Access to a URL only for a specified IP Address

I have deployed a Java web application in Tomcat 7 server. I need to allow Access to a URL only for a specified IP Address. For this I added below code in application's WEB-INF/web.xml. But it is not working. It is allowing access to "registration.do" for all IP Address. How to achieve this in web.xml? Any other option to implement this? Please advice.

     <filter>
      <filter-name>Remote Address Filter</filter-name>
      <filter-class>org.apache.catalina.filters.RemoteAddrFilter</filter-class>
      <init-param>
        <param-name>allow</param-name>
        <param-value>192\.168\.2\.39</param-value>
      </init-param>
    </filter>
    <filter-mapping>
      <filter-name>Remote Address Filter</filter-name>
      <url-pattern>/registration.do</url-pattern>
    </filter-mapping>




Aucun commentaire:

Enregistrer un commentaire