Skip to content

Instantly share code, notes, and snippets.

@pedroct92
Forked from jtgasper3/web.xml
Created December 8, 2017 16:07
Show Gist options
  • Save pedroct92/657bb1d63511d29cbf2a4fd7655b8032 to your computer and use it in GitHub Desktop.
Save pedroct92/657bb1d63511d29cbf2a4fd7655b8032 to your computer and use it in GitHub Desktop.
Force Tomcat to redirect all HTTP traffic to HTTPS.
<!--
To force Tomcat to redirect and revert all requested HTTP traffic over to HTTPS, configure the `conf/web.xml` file with the below block.
This should be placed at the very end of the file near and above the ending `</webapp>` tag:
-->
<security-constraint>
<web-resource-collection>
<web-resource-name>Automatic Forward to HTTPS/SSL
</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment