You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example that reproduces the problem uploaded to Github
Full description of the issue provided (see below)
Full description
All static resources located in src/main/webapp are served with Http header "Cache-Control:no-store",
this causes a slow response and a high http traffic as the browser does not use cache and downloads these resources every time.
I've tried to set the header (response.setHeader('Cache-Control', 'max-age=600')) using an Interceptor or a Filter with no luck,
it is set to 'no-store' later in the response chain.
Is it possible to change this behaviour?
Steps to Reproduce
create an empty 3.2.4 app
add some static resource to src/main/webapp for example src/main/webapp/css/style.css
This solution DOES work but how can we avoid this on certain file types? I have an SPA with an index.html that I absolutely do not want cached but I want everything else cached until eternity because new builds have new file names for everything but index.html
I was a bit curious about this so dug in a bit - as a work around you can add your own no-cache ResourceHandler for index.html and then have the static resources use the cachePeriod - Though I think it'd be worth while to add this in as an option in grails as SPA's being used more often.
@ConfigurationclassSpaResolverConfigimplementsWebMvcConfigurer {
privatestaticfinalString[] CLASSPATH_RESOURCE_LOCATIONS= ["classpath:/public/"]
@OverridevoidaddResourceHandlers(ResourceHandlerRegistryregistry) {
registry.addResourceHandler('/static/index.htm*') // needs to be an antmatcher
.addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS)
.setCachePeriod(0)
}
}
Task List
Full description
All static resources located in src/main/webapp are served with Http header "Cache-Control:no-store",
this causes a slow response and a high http traffic as the browser does not use cache and downloads these resources every time.
I've tried to set the header (response.setHeader('Cache-Control', 'max-age=600')) using an Interceptor or a Filter with no luck,
it is set to 'no-store' later in the response chain.
Is it possible to change this behaviour?
Steps to Reproduce
Expected Behaviour
Actual Behaviour
All static resources are served with Http header "Cache-Control:no-store"
Environment Information
Example Application
myapp.zip
The text was updated successfully, but these errors were encountered: