We have an application using OpenSymphony SiteMesh to assemble pages, and we've added the OWASP ESAPI ClickjackFilter to add the X-FRAME-OPTIONS header to responses.
However, it only works if the ClickjackFilter mapping comes after the SiteMeshFilter mapping in web.xml. If the clickjacking filter comes first, then the X-FRAME-OPTIONS header isn't added.
This works:
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/web/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Clickjacking filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
This doesn't work:
<filter-mapping>
<filter-name>Clickjacking filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/web/*</url-pattern>
</filter-mapping>
Why would the ordering of these two filters matter?