Search code examples
grailsasset-pipelinegrails3

assets folder not accessible in production?


When the grails 3 application with asset pipeline is deployed to production then the css files are bundled as shown below. When we click the link it is not accessible. Because of this the styles are not applied to the pages. The styles works in development in local machine but doesnt work when it is in remote server. How can we make so that the assets files are publicly accessible so that the styles could be applied to the pages? Thanks for help!

enter image description here


Solution

  • You can express like the following:

    grails.plugin.springsecurity.controllerAnnotations.staticRules = [
        // ...
        [pattern: '/somePath/assets/**',      access: ['permitAll']],
        // ...
    ]
    

    See https://grails-plugins.github.io/grails-spring-security-core/3.2.x/index.html#pessimistic-lockdown for a lot more detail.