grails-spring-security-core icon indicating copy to clipboard operation
grails-spring-security-core copied to clipboard

Setting Security Headers like X-Content-Type

Open samism91 opened this issue 4 years ago • 1 comments

Setting Security Headers like X-Content-Type

I have set the headers in conf/web.xml in Tomcat 8.5.69 but it is not working so found out that we can do it with spring security as well.

Grails Version: 2.5.5 Spring Security Core Plugin: 2.0.0 Tomcat Version: 8.5.69

Can someone help?

samism91 avatar Aug 18 '21 09:08 samism91

@samism91 There must be some way to configure the security headers with grails-spring-security-plugin as it is possible with spring security directly (see: https://docs.spring.io/spring-security/site/docs/5.0.x/reference/html/headers.html) ....

but we could also not figure out how to do it ... therefore we just implemented a filter in grails that adds the security headers. Have a look at https://stackoverflow.com/questions/36781490/how-to-add-strict-transport-security-header-to-a-grails-application it's a complete example how to do it.

m4rc77 avatar Feb 03 '23 16:02 m4rc77