Skip to content

Commit 1ffcb21

Browse files
author
Guillaume Chau
committed
fix(serve): force disable HTTP cache
1 parent 25171a5 commit 1ffcb21

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

packages/@vue/cli-ui/apollo-server/connectors/client-addons.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function serve (req, res) {
5656
const resolvedPath = require.resolve(addon.path)
5757
const basePath = resolveModuleRoot(resolvedPath)
5858
if (basePath) {
59-
res.sendFile(path.join(basePath, file))
59+
res.sendFile(path.join(basePath, file), { maxAge: 0 })
6060
} else {
6161
res.status(404)
6262
res.send(`File not found (resolved: ${resolvedPath}`)

packages/@vue/cli-ui/apollo-server/connectors/plugins.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ function serveFile ({ pluginId, projectId = null, file }, res) {
518518

519519
const basePath = pluginId === '.' ? baseFile : dependencies.getPath({ id: decodeURIComponent(pluginId), file: baseFile })
520520
if (basePath) {
521-
res.sendFile(path.join(basePath, file))
521+
res.sendFile(path.join(basePath, file), { maxAge: 0 })
522522
return
523523
}
524524

packages/@vue/cli-ui/apollo-server/server.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ const distPath = path.resolve(__dirname, '../dist')
99
const publicPath = path.resolve(__dirname, '../ui-public')
1010

1111
module.exports = app => {
12-
app.use(express.static(distPath))
13-
app.use('/public', express.static(publicPath))
12+
app.use(express.static(distPath, { maxAge: 0 }))
13+
app.use('/public', express.static(publicPath, { maxAge: 0 }))
1414
app.use('/_plugin/:id/*', plugins.serve)
1515
app.use('/_plugin-logo/:id', plugins.serveLogo)
1616
app.use('/_addon/:id/*', clientAddons.serve)
17-
app.use(fallback(path.join(distPath, 'index.html')))
17+
app.use(fallback(path.join(distPath, 'index.html'), { maxAge: 0 }))
1818
}

0 commit comments

Comments
 (0)