Xframe option in tomcat 7

前端 未结 1 594
春和景丽
春和景丽 2020-12-16 14:52

I have added the below code snippet in my tomcat web.xml to prevent clickjacking.

In the section to add built-in filter, I have added


         


        
相关标签:
1条回答
  • 2020-12-16 15:36

    I also had this issue with tomcat7 and the exact same filter.

    The first thing you should do is check the tomcat logs under CATALINA_BASE/logs/. Locate and open localhost.YYYY-MM-DD.log; there you should find the cause for the error.

    In my log file I had this error:

    SEVERE: Exception starting filter httpHeaderSecurity
    java.lang.ClassNotFoundException: org.apache.catalina.filters.HttpHeaderSecurityFilter
    

    I then found out that the HttpHeaderSecurityFilter was newly added in Tomcat Version 7.0.63 (see here) but I was running version 7.0.52 (the one that comes with Ubuntu 14.04 LTS).

    I resolved the issue by installing the newest Tomcat version and now the filter works as expected.

    0 讨论(0)
提交回复
热议问题