I would like to add X-Frame-Options header to all but some pages in my Spring application. Spring Security 3.2 offers nice capability to add that header to all responses via <headers> <frame-options /> </headers>
configuration.
But could it be possible to exclude this header from some paths? I considered subclassing XFrameOptionsHeaderWriter
and do some path regexp matching inside, but it seems a bit ugly. Maybe there is more convenient way to accomplish this?
I found out how to do it with XML configuration: