Unverified Commit 6a204593 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

docs: add middleware bypass note to CDN caching guide (#92132)

## Summary
- add a Good to know note in the CDN Caching guide
- clarify that if Proxy/Middleware runs behind the CDN cache,
middleware-dependent requests should bypass cache so Proxy/Middleware
remains the source of truth

---------
Co-authored-by: 's avatarJoseph <sephxd1234@gmail.com>
parent bd90bc42
......@@ -52,6 +52,8 @@ App Router responses can vary based on several custom request headers. Next.js s
- `next-router-segment-prefetch` — the specific segment being prefetched
- `next-url` — added only for routes that use [interception routes](/docs/app/api-reference/file-conventions/intercepting-routes), carries the URL being intercepted
> **Good to know:** [`proxy.js`](/docs/app/api-reference/file-conventions/proxy) (previously Middleware) should run before the CDN cache so it remains the source of truth for auth, redirects, and rewrites. If your deployment places `proxy.js` behind the CDN, configure the cache layer to bypass caching for routes that depend on `proxy.js` decisions.
Many CDNs don't support `Vary` without additional configuration. Next.js addresses this with the `_rsc` search parameter: a hash of the relevant request header values that acts as a cache-key, ensuring different response variants get different cache keys. This ensures correct responses even on CDNs that ignore `Vary`.
## Handling Headers at the CDN
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment