Also set proper maxAge headers for static files

Files in the /static dir seem to not have the proper expire headers
This commit is contained in:
Jordy van den Aardweg 2017-05-22 11:26:35 +02:00 committed by GitHub
parent 6d969b0e37
commit 1a3f386627

View File

@ -90,7 +90,9 @@ class Nuxt {
// renderer used by Vue.js (via createBundleRenderer) // renderer used by Vue.js (via createBundleRenderer)
this.renderer = null this.renderer = null
// For serving static/ files to / // For serving static/ files to /
this.serveStatic = pify(serveStatic(resolve(this.srcDir, 'static'))) this.serveStatic = pify(serveStatic(resolve(this.srcDir, 'static'), {
maxAge: (this.dev ? 0 : '1y') // 1 year in production
}))
// For serving .nuxt/dist/ files (only when build.publicPath is not an URL) // For serving .nuxt/dist/ files (only when build.publicPath is not an URL)
this.serveStaticNuxt = pify(serveStatic(resolve(this.dir, '.nuxt', 'dist'), { this.serveStaticNuxt = pify(serveStatic(resolve(this.dir, '.nuxt', 'dist'), {
maxAge: (this.dev ? 0 : '1y') // 1 year in production maxAge: (this.dev ? 0 : '1y') // 1 year in production