I need to add X-Frame-Options to prevent Clickjacking in my application. But am unable to find any source for adding that in tomcat of the version 5.5.33 . Is there a solution or workaround possible?
Your version of tomcat is dated 2011, version 5.5 has been archived in 2012 - this might be a good time to think about upgrading.
As a short term fix (in case you don't get any answer to how your problem can be solved with just this ancient version) this is a good usecase for having Apache httpd serve ports 80 and 443, then forward to tomcat with mod_jk
, mod_proxy
or mod_proxy_jk
. In Apache you can just conditionally or unconditionally set the appropriate header using the Header
directive.