Hi folks, I was upgrading an old grails app to gra...
# questions
d
Hi folks, I was upgrading an old grails app to grails 6 and we used to be able to serve static html content that were placed in "web-app" folder before, but now the location seems to have been moved to "sec/main/webapp"(https://gsp.grails.org/6.0.0/guide/resources.html). However when I move the static content there, the page is not accessible and I am getting 404 not found. Anyone know a solution for it. Created a bug for it here as well : https://github.com/grails/grails-core/issues/13414
t
You want to place the static files in the
src/main/resources/public
directory. For example, the file
src/main/resources/public/images/favicon.ico
is accessible by navigating to the URL http://localhost:8080/static/images/favicon.ico when your Grails app is running. If you use Grails Spring Security plugin, make sure that you have a rule to permitAll access to everything under the `/static/ path.
Copy code
- pattern: "/static/**"
   access: ["permitAll"]
I can't remember when that change took place, but I know it is that way for Grails 5 too.
d
Thanks for the response, I managed to get things working by placing the files in src/main/webapp folder and adding this config
Copy code
grails:
  resources:
    pattern: "/**"
However now I need to sort out how to auto redirect to index.html, because currently I have to hit url like http://localhost:8080/test/index.html, but ideally we would want http://localhost:8080/test.