我目前正在尝试为我的 java 应用程序实现更多安全措施,并且遇到了使用 x-content-type-options no sniff 的建议。经过我的搜索,我无法找到任何实现此功能的方法。非常感谢任何帮助。
最佳答案
假设你正在使用Spring,你可以尝试 -
<mvc:annotation-driven/>
<mvc:interceptors>
<bean id="webContentInterceptor"
class="org.springframework.web.servlet.mvc.WebContentInterceptor">
<property name="X-Content-Type-Options" value="nosniff"/>
</bean>
</mvc:interceptors>
关于java - 添加 X-Content-Type-Options Nosniff,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15979244/