This commit is contained in:
parent
df2ccf86b2
commit
8ebafd8bae
@ -5,13 +5,14 @@ upstream parsley_app {
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
root /parsley/public;
|
||||
root /parsley/dist;
|
||||
|
||||
location / {
|
||||
try_files $uri @rails;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ @rails;
|
||||
}
|
||||
|
||||
location ~ ^/(assets|packs)/ {
|
||||
location ~ ^/(css|img|js)/ {
|
||||
try_files $uri @rails;
|
||||
gzip_static on;
|
||||
expires 1y;
|
||||
|
@ -1,7 +1,12 @@
|
||||
import { NetworkFirst, StaleWhileRevalidate } from 'workbox-strategies';
|
||||
import { NetworkFirst, NetworkOnly, StaleWhileRevalidate } from 'workbox-strategies';
|
||||
import { BroadcastUpdatePlugin } from 'workbox-broadcast-update/BroadcastUpdatePlugin';
|
||||
import { cleanupOutdatedCaches, precacheAndRoute } from 'workbox-precaching';
|
||||
import { defaultHandler, registerRoute } from 'workbox-routing';
|
||||
import { setDefaultHandler, registerRoute } from 'workbox-routing';
|
||||
import { setCacheNameDetails } from 'workbox-core';
|
||||
|
||||
setCacheNameDetails({
|
||||
prefix: 'parsley'
|
||||
});
|
||||
|
||||
cleanupOutdatedCaches();
|
||||
precacheAndRoute(self.__WB_MANIFEST);
|
||||
@ -10,10 +15,18 @@ const isStaleWhileRevalidate = ({ request }) => {
|
||||
return request.headers.get('Cache-Then-Network') === 'true';
|
||||
};
|
||||
|
||||
registerRoute(isStaleWhileRevalidate, new StaleWhileRevalidate({
|
||||
registerRoute(
|
||||
isStaleWhileRevalidate,
|
||||
new StaleWhileRevalidate({
|
||||
plugins: [
|
||||
new BroadcastUpdatePlugin()
|
||||
]
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
defaultHandler(new NetworkFirst());
|
||||
registerRoute(
|
||||
new RegExp('^(?!http).+'),
|
||||
new NetworkOnly()
|
||||
);
|
||||
|
||||
setDefaultHandler(new NetworkFirst());
|
||||
|
Loading…
Reference in New Issue
Block a user