Browser caching

Topics: Administration, Core
Jan 28 at 6:26 PM
We've run into a problem when a file changes, like a .js files, or .cshtml, and the user doesn't get the change unless they press Ctrl-F5 because the cache setting in the header is set to 7 days. What is the recommended way of controlling this in Orchard, either for a specific file or for all files? I looked into the Orchard.OutputCache module, but this doesn't appear to apply to the client-side caching.
Developer
Jan 28 at 6:47 PM
You could do the following:
  • Change the cache duration from 7 days to something else. You can do this from the Web.configs inside your Styles and Scripts folders.
  • Append some cache busting parameter to the included resource's URL. I'm not sure this works (vaguely remember a bug report about this the query string being stripped from Stlyle/Script.Include() results) and even if yes it would only work with Include() but not with Require().
  • Use the Combinator module. Its main feature is resource bundling and minification but it does this with also appending the timestamp of last modification to the URL of the resources.
Marked as answer by jwfallaw on 2/4/2014 at 6:32 AM