我使用Apache Tomcat 8.5.9服务器用于带有struts2,spring和spring-security的Java Web应用程序。在使用“ Zap 2.7.0安全扫描工具”进行安全测试时,我在网络应用程序的扫描报告中出现以下错误。
为此,我在conf文件夹中的Apache Tomcat 8.5.9服务器的 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>antiClickJackingEnabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>antiClickJackingOption</param-name>
<param-value>SAMEORIGIN</param-value>
</init-param>
<init-param>
<param-name>xssProtectionEnabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>blockContentTypeSniffingEnabled</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>httpHeaderSecurity</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
即使使用上述代码后,错误也无法解决。但是当我尝试在Apache Tomcat 7.0.5中使用上面的代码时它工作正常
任何人都可以告诉我在Apache Tomcat 8.5.9服务器中遗漏了什么。
答案 0 :(得分:0)
我想在require(nycflights13)
require(data.table)
require(dplyr)
flights_tv <- flights %>% select(year:day, hour, origin, dest, carrier)
left_join_tv <- flights_tv %>% left_join(airports, c("dest" = "faa"))
中显示pdf时遇到问题。我做到了。
<iframe></iframe>
我将pdfs放在portafolio目录中。我也修改了Apache tomcat的web.xml。
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
registry.addResourceHandler("/jspf/**").addResourceLocations("/jspf/");
// registry.addResourceHandler("/Portafolios/**").addResourceLocations("/Portafolios/");
registry.addResourceHandler("/portafolio/**")
.addResourceLocations("file:"+System.getProperty("user.home")+"/Documents/PPP/")
.setCacheControl(CacheControl.maxAge(2, TimeUnit.HOURS).cachePublic());
super.addResourceHandlers(registry);
}
我修改了SecurityConfig类的configure()方法。
<filter>
<filter-name>httpHeaderSecurity</filter-name>
<filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>
<async-supported>true</async-supported>
<init-param>
<param-name>antiClickJackingEnabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>antiClickJackingOption</param-name>
<param-value>SAMEORIGIN</param-value>
</init-param>
</filter>
您可能拥有web.xml,但我认为您缺少修改configure()方法的方法。您可以检查spring
的页面