Skip to content

Force HTTPS in Tomcat

Force HTTPS in Tomcat published on

To force every webapp to use https instead of http, add the following part in $TOMCATHOME/conf/web. Insert it at the second last line, before end tag </web-apps>

<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>