Skip to content

Commit d3cfd75

Browse files
authored
fix(cli): serve index file with no-cache headers quasarframework#8221 (quasarframework#8226)
quasarframework#8221
1 parent 4ed855b commit d3cfd75

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cli/bin/quasar-serve

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,22 @@ if (ssrDetected === false) {
129129

130130
const
131131
express = require('express'),
132+
resolvedIndex = resolve(argv.index),
132133
microCacheSeconds = argv.micro
133134
? parseInt(argv.micro, 10)
134135
: false
135136

136137
function serve (path, cache) {
137138
const opts = {
138-
maxAge: cache ? parseInt(argv.cache, 10) * 1000 : 0
139+
maxAge: cache ? parseInt(argv.cache, 10) * 1000 : 0,
140+
setHeaders (res, path) {
141+
if (res.req.method === 'GET' && path === resolvedIndex) {
142+
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
143+
res.set('Pragma', 'no-cache')
144+
res.set('Expires', '0')
145+
res.set('Surrogate-Control', 'no-store')
146+
}
147+
}
139148
}
140149

141150
if (argv.history !== true) {

0 commit comments

Comments
 (0)