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
<filter>
<filter-name>httpHeaderSecurity</filter-name>
<filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>
<init-param>
<param-name>antiClickJackingOption</param-name>
<param-value>SAMEORIGIN</param-value>
</init-param>
</filter>
For filter-mapping part I have added.
<filter-mapping>
<filter-name>httpHeaderSecurity</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
After editing and making these two changes,test page (html page where I am trying to open the target page in <frame>
) passes (not able to open the target page inside frames).
But the apache welcome page gives 404 with the new changes.
Please let me know if I am missing anything.