How to block access to a specific URL (<url-pattern> with wildcards *) at Tomcat

14 Views Asked by At

I followed this tutorial to block specific endpoints.

In some cases, you may wish to restrict access to a specific URL

D:\CS\application\WEB-INF\web.xml

(..)
<security-constraint>  
<web-resource-collection>  
<web-resource-name>Protected API Members</web-resource-name>  
<url-pattern>/cs.exe/api/v*/members/*</url-pattern>  
<http-method>GET</http-method>  
</web-resource-collection>  
<auth-constraint />  
</security-constraint>  
</web-app>

The wildcard v* doesnt't work. Only the wildcard at the end members/* works. How-To specify wildcards in the middle of the API path.

Screenshot from IIS (we migrate the App to Tomcat):

enter image description here

0

There are 0 best solutions below