title: ClickJacking Filter to add X-FRAME-OPTIONS in response
body: <p>In order to tackle clickJacking and blocking my site to be opened by iframe I have created a servlet filter in which I am adding below line to add "X-FRAME-OPTIONS" response header. But when I run page and see response headers of that page I never get this header in there. Any Idea why?</p>
  
  <pre><code>public void doFilter(
          ServletRequest request, ServletResponse response, FilterChain chain
          ) throws IOException, ServletException
      {
  
          HttpServletResponse res = (HttpServletResponse)response;
          chain.doFilter(request, response);
  
          //Specify the mode
          res.addHeader("X-FRAME-OPTIONS", "DENY");
      }
  </code></pre>