content icon indicating copy to clipboard operation
content copied to clipboard

Nuxt Content API crashes when using Nitro multi-domain cache (`varies`)

Open maximepvrt opened this issue 2 months ago • 1 comments

Environment

  • Operating System: Linux
  • Node Version: v20.19.1
  • Nuxt Version: 4.2.1
  • CLI Version: 3.30.0
  • Nitro Version: 2.12.9
  • Package Manager: [email protected]
  • Builder: -
  • User Config: modules, devtools, nitro, compatibilityDate
  • Runtime Modules: @nuxt/[email protected]
  • Build Modules: -

Version

v3

Reproduction

https://stackblitz.com/edit/github-mme2nabf?file=nuxt.config.ts

Description

When configuring Nitro to handle multi-domain caching using the varies option as documented here, the Nuxt Content API stops working and crashes the application.

Reproduction:

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nuxt/content'],
  devtools: { enabled: true },
  nitro: {
    routeRules: {
      '**': {
        cache: {
          varies: ['host', 'x-forwarded-host'],
        },
      },
    },
  },
  compatibilityDate: '2024-04-03',
});

Additional context

No response

Logs


maximepvrt avatar Nov 16 '25 17:11 maximepvrt

This is strange, when cache is enables, Nitro does not execute event handler and treats url and Vue page. And this cause infinite api calls

farnabaz avatar Nov 18 '25 13:11 farnabaz