Nuxt Skew Protection needs persistent storage to preserve previous build assets across deployments.
By default, it uses the filesystem storage located at node_modules/.cache/nuxt-seo/skew-protection, but this may not be sufficient
for all deployment environments, especially in CI/CD pipelines where caches may be cleared frequently.
You can control how long versions are kept. By default, the configuration is setup for optimal crawler compatibility.
export default defineNuxtConfig({
skewProtection: {
// Keep versions for 45 days
retentionDays: 45,
// Keep maximum 15 versions
maxNumberOfVersions: 15
}
})
Cleanup happens during build, removing:
retentionDaysmaxNumberOfVersionsThe default filesystem storage works with GitHub Actions caching to persist build assets between deployments
using the actions/cache GitHub Action.
actions/cache won't save new assets (it only saves on cache miss).jobs:
build:
runs-on: ubuntu-latest
steps:
# Install...
- name: Cache for Nuxt SEO
uses: actions/cache@v4
with:
path: node_modules/.cache/nuxt-seo
key: nuxt-skew-${{ github.sha }}
restore-keys: |
nuxt-skew-
# Build, etc..
The restore-keys fallback ensures previous assets are restored, while the unique github.sha key ensures new assets are saved after each build.
If you have your deployments running through Cloudflare then the node_modules folder should automatically persist between deployments, so no additional configuration is required.
If you're deploying to Cloudflare using your own CI pipeline, you can use Cloudflare KV storage to persist build assets.
See the dedicated Cloudflare Deployment guide which covers storage configuration in detail.
export default defineNuxtConfig({
skewProtection: {
storage: {
driver: 'redis',
host: process.env.REDIS_HOST || 'localhost',
port: Number(process.env.REDIS_PORT) || 6379,
password: process.env.REDIS_PASSWORD,
db: 0,
base: 'skew-protection'
}
}
})
In cases where you're already using a CDN with long cache times on /_nuxt/** assets, you may want to disable persistent storage.
export default defineNuxtConfig({
skewProtection: {
// Disable persistent storage
bundlePreviousDeploymentChunks: false
}
})