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
{{ message }}
Repository navigation
ResourceHttpRequestHandler serves all files with must-revalidate cache header, should not do that when using a content versioning strategy [SPR-12562] #16988
The point is to server the resources once and only one per URL. The resources do not ned to be checked, if in the browser cache.
However, the default behaviour of the ResourceHttpRequestHandler is to add a must-revalidate to the Cache-Control header. This adds an un-necessary round-trip for every resource. On a single page, this can be something like 50+ unnecessary HTTP roundtrips.
The bug is in ResourceHttpRequestHandler#handleRequest:
line 250: checkAndPrepare(request, response, true);
That hardcoded "true" causes (some ways down the call-stack) WebContentGenerator#cacheForSeconds to apply the header (argument is "mustRevalidate"):
Activity
spring-projects-issues commentedon Mar 23, 2015
Brian Clozel commented
As of 4.2,
ResourceHttpRequestHandlers don't serve resources with a "Cache-Control: must-revalidate" header.Also, #16413 (and sub-tasks) allow to configure flexible strategies for HTTP caching like this:
This will add a "Cache-Control: max-age=31536000, no-transform" response header when serving resources.