Skip to content

Ignore specific Query Parameters in routeRules cache configuration #33728

@coltisor

Description

@coltisor

Describe the feature

We have SSR caching configured with Redis storage:

routeRules: {
  '/store/**': {
    cache: {
      maxAge: 3600,
      base: 'storefront-cache', // Redis storage
    }
  }
}

Problem

Unfortunately, Nuxt's routeRules caching treats URLs with different query parameters as separate cache entries. This breaks caching for tracking/analytics parameters that don't affect page content.

Example - Same page, different cache entries:

  • /store/c/sale?utm_source=email&sc_uid=abc123
  • /store/c/sale?utm_source=email&sc_uid=xyz789

This creates thousands of cache entries for identical content, making SSR cache ineffective.

Proposed solution

Add ignoreQueryParams to route cache config:

routeRules: {
  '/store/**': {
    cache: {
      maxAge: 3600,
      base: 'storefront-cache',
      ignoreQueryParams: ['utm_source', 'sc_uid']
    }
  }
}

Cache key would be generated without these params, but original URL preserved for the app.

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Discussing

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions