This commit is contained in:
parent
df2ccf86b2
commit
8ebafd8bae
@ -5,13 +5,14 @@ upstream parsley_app {
|
|||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
root /parsley/public;
|
root /parsley/dist;
|
||||||
|
|
||||||
location / {
|
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;
|
try_files $uri @rails;
|
||||||
gzip_static on;
|
gzip_static on;
|
||||||
expires 1y;
|
expires 1y;
|
||||||
@ -27,4 +28,4 @@ server {
|
|||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 { BroadcastUpdatePlugin } from 'workbox-broadcast-update/BroadcastUpdatePlugin';
|
||||||
import { cleanupOutdatedCaches, precacheAndRoute } from 'workbox-precaching';
|
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();
|
cleanupOutdatedCaches();
|
||||||
precacheAndRoute(self.__WB_MANIFEST);
|
precacheAndRoute(self.__WB_MANIFEST);
|
||||||
@ -10,10 +15,18 @@ const isStaleWhileRevalidate = ({ request }) => {
|
|||||||
return request.headers.get('Cache-Then-Network') === 'true';
|
return request.headers.get('Cache-Then-Network') === 'true';
|
||||||
};
|
};
|
||||||
|
|
||||||
registerRoute(isStaleWhileRevalidate, new StaleWhileRevalidate({
|
registerRoute(
|
||||||
plugins: [
|
isStaleWhileRevalidate,
|
||||||
new BroadcastUpdatePlugin()
|
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