Most likely you don't want to deactivate this Header completely, but use SAMEORIGIN
. If you are using the Java Configs (Spring Boot
) and would like to allow the X-Frame-Options: SAMEORIGIN
, then you would need to use the following.
For older Spring Security versions:
http
.headers()
.addHeaderWriter(new XFrameOptionsHeaderWriter(XFrameOptionsHeaderWriter.XFrameOptionsMode.SAMEORIGIN))
For newer versions like Spring Security 4.0.2:
http
.headers()
.frameOptions()
.sameOrigin();