Skip to content

Commit

Permalink
fix: cache headers for prerendered sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Jan 6, 2024
1 parent db3f337 commit 57bef21
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ declare module 'vue-router' {
// add route rules for sitemap xmls so they're rendered properly
routeRules.headers = {
'Content-Type': 'text/xml; charset=UTF-8',
'Cache-Control': config.cacheMaxAgeSeconds ? `public, max-age=${config.cacheMaxAgeSeconds}, must-revalidate` : 'no-cache, no-store',
'X-Sitemap-Prerendered': new Date().toISOString(),
}
}
if (!nuxt.options.dev && !isNuxtGenerate() && config.cacheMaxAgeSeconds && config.runtimeCacheStorage !== false) {
Expand Down

0 comments on commit 57bef21

Please sign in to comment.