Skip to content
Discussion options

You must be logged in to vote

You can’t remove the x-nextjs-cache header through configuration — it’s automatically added by Next.js to indicate cache behavior (HIT, MISS, STALE, etc.).

If you need to hide it for security or compliance reasons, you can strip it at the proxy or CDN layer (e.g., Vercel Edge Config, CloudFront, Nginx, etc.).

Example for Nginx:

proxy_hide_header x-nextjs-cache;

Example for Vercel:

{
  "headers": [
    {
      "source": "/(.*)",
      "headers": [{ "key": "x-nextjs-cache", "value": "" }]
    }
  ]
}

In short: Next.js doesn’t provide a built-in flag to disable it, but it can be safely removed at the CDN or reverse proxy level.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by svyas-jeavio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants