tomcat设置Strict Transport Security
- 在Tomcat的conf/server.xml文件中,找到Connector节点,添加以下属性:
secure="true" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" redirectPort="8443" compression="on" compressableMimeType="text/html,text/xml,text/javascript,text/css"
- 在Tomcat的web.xml文件中,添加以下过滤器:
- 在Tomcat的conf/web.xml文件中,添加以下配置:
- 重启Tomcat服务器,访问网站时浏览器会自动保存HSTS信息,并在以后访问时强制使用HTTPS连接
原文地址: https://www.cveoy.top/t/topic/fvCQ 著作权归作者所有。请勿转载和采集!