How to block particular url in Tomcat

First go to web.xml file conf directory…

vim /home/ec2-user/apache-tomcat-9.0.36/conf/web.xml

and define these lines :-

<security-constraint>
 <web-resource-collection>
   <url-pattern>/*</url-pattern>
 </web-resource-collection>
 <auth-constraint>
   <role-name>admin</role-name>
   <role-name>user</role-name>
 </auth-constraint>
</security-constraint>
<login-config>
  <auth-method>BASIC</auth-method>
  <realm-name>Test Realm</realm-name>
</login-config>

Replace or define the URL in url-pattern section

 

Also, Read This Blog:-  How to increase concurrent connections on apache server.

Leave a Reply

Your email address will not be published. Required fields are marked *