Forcing the use of SSL automatically from HTTP request on Tomcat

Hi All,

In this article I will show how we can secure the application resources by converting the HTTP request to HTTPS request.

This is also known as Forcing the use of SSL.

A security constraint can be set up to force certain areas of your application (or your entire application) into SSL mode. This is useful if those resources will be used for confidential information, such as login details or the entry of credit card details.

To implement this we just have to make changes in web.xml by creating a <transport-guarantee element> in a <user-data-constraint> element.

<<Even this works well in JBoss and Weblogic >>




<!– Protect all resources –>



<!– All access to the application resources is going to SSL protected –>





[Note] On Tomcat Make sure your standard HttpConnector in server.xml has redirectPort=”YOUR_SSL_PORT”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s