How to give request matcher in Spring Security for x frame options?

前端 未结 1 1151
忘了有多久
忘了有多久 2021-01-23 16:38

I have enabled Spring Security headers.

My code is like this:


               


        
1条回答
  •  隐瞒了意图╮
    2021-01-23 17:02

    You can use a DelegatingRequestMatcherHeaderWriter, see Spring Security Reference:

    20.2.3 DelegatingRequestMatcherHeaderWriter

    At times you may want to only write a header for certain requests. For example, perhaps you want to only protect your log in page from being framed. You could use the DelegatingRequestMatcherHeaderWriter to do so. When using the XML namespace configuration, this can be done with the following:

    
      
    
      
          
          

    To use DENYand SAMEORIGIN for different URLs you have to add two header elements with two different DelegatingRequestMatcherHeaderWriter.

    0 讨论(0)
提交回复
热议问题