HTTP Strict Transport Security (HSTS) a simple and widely-supported standard to protect visitors by ensuring that their browsers always connect to a website over HTTPS.
To configure HSTS:
-
Open the
<Tomcat>/conf/web.xmlfile in a text editor. -
Remove the following:
-
httpHeaderSecurity filterdefinition -
<filter-mapping>section
-
-
Add the
hstsMaxAgeSecondsparameter.<filter> <filter-name>httpHeaderSecurity</filter-name> <filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class> <init-param> <param-name>hstsMaxAgeSeconds</param-name> <param-value>31536000</param-value> </init-param> <async-supported>true</async-supported> </filter> <filter-mapping> <filter-name>httpHeaderSecurity</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> </filter-mapping> -
Save changes.
-
Restart Tomcat.