Skip to main content
InfoConfigOWASP A05:2021CWE-200

How to fix: X-Nextjs-Cache Reveals Next.js ISR Cache State

Next.js sets X-Nextjs-Cache: HIT | MISS | STALE | BYPASS to indicate ISR/SSG cache state. This leaks framework architecture details to any client.

Why it matters

Confirms that the application uses Next.js and reveals ISR/SSG cache configuration, helping attackers target Next.js-specific vulnerabilities (e.g., SSRF via getStaticProps, path traversal in ISR routes).

X-Nextjs-Cache is a Next.js-specific response header that was added for debugging ISR behavior. It has no user-facing benefit and should be removed in production.

How to fix it

  1. 1Strip X-Nextjs-Cache in next.config.js headers config or via middleware.
  2. 2Use an env guard to only emit it in development.

Code examples

Next.js middleware (strip header)

TypeScript
// middleware.ts
import { NextResponse } from 'next/server';

export function middleware(req) {
  const res = NextResponse.next();
  res.headers.delete('x-nextjs-cache');
  return res;
}

References

Detected automatically by VulnRadar. The check id is x-nextjs-cache, stable across every scan so you can filter or diff on it.

See every config check

Questions

How severe is X-Nextjs-Cache Reveals Next.js ISR Cache State?
VulnRadar rates this info severity in the config category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id x-nextjs-cache, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does X-Nextjs-Cache Reveals Next.js ISR Cache State map to?
It maps to CWE-200. In the OWASP Top 10 it falls under A05:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for x-nextjs-cache reveals next.js isr cache state

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

X-Nextjs-Cache Reveals Next.js ISR Cache State | VulnRadar