Reputation: 145
I have a problem with a personal application.
Each time I upload a new version of It, my users have problems with css, js and images resources.
I would like to do something that change the URL of those resources at every new version (the project includes maven) but still cache informations to gain page loading time.
But I don't know if I can change the URL of call and don't change the path of the resource in the app. Does any solution exists such as filter or url rewriter? (Like /{version}/res/css/style.css
) I can't find anything about It...
Upvotes: 0
Views: 47
Reputation: 3118
You could add a query parameter ?v={version} to your static resource requests.
RFC 3986 states that
The query component contains non-hierarchical data that, along with data in the path component, serves to identify a resource within the scope of the URI's scheme and naming authority
Thus the parameter should be taken into account when caching.
Most browsers will cache it. Perhaps some proxy servers will not, these days most will. The assumptions that it does not happen are based on 8 year old findings, see Steve Sounders's blog
You could rev the filename itself or the path. That are the other options.
Upvotes: 1