Search code examples
httpcachingbrowser-cachecache-control

Does Cache-Control header control the cache for CSS and JS files within the page


Cache-Control header is set to no-cache, no-store, must-revalidate in the page. Does this apply to the CSS and JS files included in the page. We would like CSS and JS files to be downloaded each time the page is accessed.


Solution

  • Does this apply to the CSS and JS files included in the page

    No. A Cache-Control header only applies to the specific resource being returned, and not any referenced resources. Set the same headers on the .js and .css files you serve if you want to control how they are cached.