How to enable CORS in Grails 3.0.1

后端 未结 7 1314
有刺的猬
有刺的猬 2021-02-18 22:45

I would like to do cross origin communication using Grails in server side. The only documentation that I found is this one

https://grails.org/plugin/cors

but thi

相关标签:
7条回答
  • 2021-02-18 23:09

    If you need to enable CORS for endpoints provided by the Spring Security core/rest plugins you have to add this:

    Bootstrap.groovy:

    SpringSecurityUtils.clientRegisterFilter("corsFilter",
        SecurityFilterPosition.SECURITY_CONTEXT_FILTER.order - 1)
    

    resources.groovy:

    beans = {
        corsFilter(CorsFilter)
    }
    
    0 讨论(0)
提交回复
热议问题