Redirect HTTP to HTTPS SSL

Redirect HTTP to HTTPS SSL

This page describes the process for forcing webserver requests for HTTP content to instead get HTTPS Content. There are different steps for IIS and Tomcat. Note: BOTH these approaches assume you’ve ALREADY installed your SSL Certificate.

Setting up IIS

Setting up IIS is easy. Put a web.config file containing the following XML at the root of the webserver:

<?xml version=”1.0″ encoding=”UTF-8″?>





<rule name=”Redirect to HTTPS” stopProcessing=”true”>

<match url=”(.*)” />


<add input=”{HTTPS}” pattern=”^OFF$” />


<action type=”Redirect” url=”https://{HTTP_HOST}/{R:1}” redirectType=”SeeOther” />






Setting up Tomcat

You need to edit the 2 Tomcat configuration files; server.xml and web.xml and then when edited restart the tomcat service.

Open server.xml typically found in tomcat/conf and change:

Connector port=”80?




Connector port=”80?



Then open web.xml (same directory) and add this snippet before the closing tag of /web-app:



<web-resource-name>Protected Context</web-resource-name>



<!– auth-constraint goes here if you requre authentication –>





Restart Tomcat and all pages should redirect to https.

Was this helpful?

0 / 0

Leave a Reply 0

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