Sharing the Point

Office 365, SharePoint, Project Server – Support Blog

How to Redirect all http requests to https on Tomcat by default

Posted by Ashraf on November 23, 2010

***Considering that you already enable SSL with proper certificate.

To auto redirect all of your webserver requests from http to https just paste the following to your tomcat installation folder\conf\web.xml file and restart the service.

<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Context</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<!– auth-constraint goes here if you requre authentication –>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>

Now browse http://localhost and it will automatically go to https://localhost , for example.

Sorry, the comment form is closed at this time.