Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid caching the service worker #2059

Merged
merged 2 commits into from
Aug 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
4 changes: 3 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
</head>

<body>
<app></app>
<app>
DIM hasn't loaded. Something may be wrong with it, or with your browser (maybe you have a content blocker, or have disabled JavaScript). Try force reloading to make sure (Ctrl-F5 or Cmd-R).
</app>
<div id="browser-warning" class="hidden">Your browser is not supported by DIM. Some or all DIM functionality may not work. Please upgrade to a supported browser.</div>

<script async src="https://www.google-analytics.com/analytics.js"></script>
Expand Down
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