google / web-starter-kit

Web Starter Kit - a workflow for multi-device websites
http://developers.google.com/web/starter-kit
Apache License 2.0
18.43k stars 3.02k forks source link

HTML Cache META attributes doesn't work #924

Open ghost opened 7 years ago

ghost commented 7 years ago

Even with the following in the HTML files, it is cached. I think, the service-worker.js is causing this issue.

<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
Garbee commented 7 years ago

Yup, SW overrides the network cache in a way by adding an extra developer-controlled cache in between. You need to handle this in your applications Service Worker or remove the SW if you don't want to handle the client-side application caching manually.

ghost commented 7 years ago

@Garbee Is there a way I can exclude certain html files from the caching? Is the following a right way to do this?

staticFileGlobs: [ // Add/remove glob patterns to match your directory setup. ${rootDir}/images/**/*, ${rootDir}/scripts/**/*.js, ${rootDir}/styles/**/*.css, // ${rootDir}/*.{html,json} ],