Monday, 10 April 2023

Redirect http to https on Apache Tomcat

 

1. Install SSL certificate on Apache Tomcat Server.


2. Backup server.xml and web.xml file under conf directory

3. Edit server.xml to define the https redirection port

    

4. Edit web.xml file and add the below content at the end of file before the </web-app> closing tag



<security-constraint>
<web-resource-collection>
<web-resource-name>Entire Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>


5. Restart Tomcat Service

6. Test the Redirection of http to https




                        Thanks !!

No comments:

Post a Comment