Skip to content

Commit

Permalink
Avoid caching the service worker
Browse files Browse the repository at this point in the history
  • Loading branch information
bhollis committed Aug 3, 2017
1 parent 6f2e63b commit 07384e1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ module.exports = (env) => {
'return.html',
],
// swSrc: './src/sw.js',
swDest: './dist/sw.js'
swDest: './dist/service-worker.js'
}));
}

Expand Down
12 changes: 12 additions & 0 deletions src/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -958,3 +958,15 @@ FileETag None
</FilesMatch>

</IfModule>

# Do not cache the service worker!

<Files "service-worker.js">
FileETag None
<IfModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header unset Expires
</IfModule>
</Files>
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ require('./app/shell/dimManifestProgress.directive');
require('./scss/main.scss');

if ($DIM_FLAVOR !== 'dev' && navigator.serviceWorker) {
navigator.serviceWorker.register('/sw.js')
navigator.serviceWorker.register('/service-worker.js')
.catch((err) => {
console.error('Unable to register service worker.', err);
});
Expand Down

0 comments on commit 07384e1

Please sign in to comment.