Prevent caching of store status updates
This commit is contained in:
parent
a3b8593133
commit
7c42800245
@ -63,7 +63,7 @@ app.use('/api', apiRouter);
|
|||||||
const staticCacheOptions = {
|
const staticCacheOptions = {
|
||||||
maxAge: process.env.NODE_ENV === 'production' ? '30d' : 0,
|
maxAge: process.env.NODE_ENV === 'production' ? '30d' : 0,
|
||||||
setHeaders: (res, filePath) => {
|
setHeaders: (res, filePath) => {
|
||||||
if (filePath.endsWith('.html')) {
|
if (filePath.endsWith('.html') || filePath.endsWith('update.json')) {
|
||||||
res.setHeader('Cache-Control', 'no-store');
|
res.setHeader('Cache-Control', 'no-store');
|
||||||
} else if (/\.(js|css|svg|ico|png|jpg|jpeg|webp|avif|woff2?)$/i.test(filePath)) {
|
} else if (/\.(js|css|svg|ico|png|jpg|jpeg|webp|avif|woff2?)$/i.test(filePath)) {
|
||||||
res.setHeader('Cache-Control', 'public, max-age=2592000, immutable');
|
res.setHeader('Cache-Control', 'public, max-age=2592000, immutable');
|
||||||
|
|||||||
@ -35,7 +35,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch('/update.json')
|
fetch(`/update.json?ts=${Date.now()}`, { cache: 'no-store' })
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
const update = data[0];
|
const update = data[0];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user