mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-16 12:54:38 +00:00
use consistent cache-control:max-age=600 for HTML pages
This commit is contained in:
@@ -136,7 +136,7 @@ export default function middleware(opts: {
|
|||||||
|
|
||||||
fs.existsSync(path.join(output, 'index.html')) && serve({
|
fs.existsSync(path.join(output, 'index.html')) && serve({
|
||||||
pathname: '/index.html',
|
pathname: '/index.html',
|
||||||
cache_control: 'max-age=600'
|
cache_control: dev() ? 'no-cache' : 'max-age=600'
|
||||||
}),
|
}),
|
||||||
|
|
||||||
fs.existsSync(path.join(output, 'service-worker.js')) && serve({
|
fs.existsSync(path.join(output, 'service-worker.js')) && serve({
|
||||||
@@ -532,6 +532,7 @@ function get_page_handler(
|
|||||||
.replace('%sapper.styles%', () => styles);
|
.replace('%sapper.styles%', () => styles);
|
||||||
|
|
||||||
res.statusCode = status;
|
res.statusCode = status;
|
||||||
|
res.setHeader('Cache-Control', dev() ? 'no-cache' : 'max-age=600');
|
||||||
res.end(body);
|
res.end(body);
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user