如何在Tomcat7中设置严格的传输安全头

mwngjboj  于 2021-10-10  发布在  Java
关注(0)|答案(0)|浏览(486)

我在web.xml文件中使用下面的代码来设置所需的头,但它不起作用。

<filter>
          <filter-name>httpHeaderSecurity</filter-name>
            <filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>
              <async-supported>true</async-supported>
                <init-param>
                        <param-name>hstsEnabled</param-name>
                            <param-value>true</param-value>
                              </init-param>
                                <init-param>
                                        <param-name>hstsMaxAgeSeconds</param-name>
                                            <param-value>31536000</param-value>
                                              </init-param>
                                                <init-param>
                                                        <param-name>hstsIncludeSubDomains</param-name>
                                                            <param-value>true</param-value>
                                                              </init-param>                                                                                                                                                                                                  </filter>

                                                          <!-- The mapping for the HTTP header security Filter -->
                                                          <filter-mapping>
                                                                <filter-name>httpHeaderSecurity</filter-name>
                                                                  <url-pattern>/*</url-pattern>
                                                                    <dispatcher>REQUEST</dispatcher>
                                                                </filter-mapping>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题