Desabilitar cache HTTP para arquivos HTML
This commit is contained in:
13
server.js
13
server.js
@@ -111,7 +111,18 @@ app.use(express.json({
|
|||||||
verify: (req, res, buf) => { req.rawBody = buf || Buffer.alloc(0); },
|
verify: (req, res, buf) => { req.rawBody = buf || Buffer.alloc(0); },
|
||||||
}));
|
}));
|
||||||
app.use('/hook', hookLimiter, verifyWebhookSignature, hookRouter);
|
app.use('/hook', hookLimiter, verifyWebhookSignature, hookRouter);
|
||||||
app.use(express.static(join(__dirname, 'public'), { maxAge: '1h', etag: true }));
|
app.use(express.static(join(__dirname, 'public'), {
|
||||||
|
etag: true,
|
||||||
|
setHeaders(res, filePath) {
|
||||||
|
if (filePath.endsWith('.html')) {
|
||||||
|
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
|
||||||
|
res.setHeader('Pragma', 'no-cache');
|
||||||
|
res.setHeader('Expires', '0');
|
||||||
|
} else {
|
||||||
|
res.setHeader('Cache-Control', 'public, max-age=3600');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}));
|
||||||
app.use('/api', apiRouter);
|
app.use('/api', apiRouter);
|
||||||
|
|
||||||
const connectedClients = new Map();
|
const connectedClients = new Map();
|
||||||
|
|||||||
Reference in New Issue
Block a user