ISR + edge middleware

HTML rendered at 2026-08-29T08:04:12.985Z (changes only when the ISR cache entry is rebuilt, expiration 600s).
Adapter @astrojs/vercel 11.0.5.

1. Does middleware run on a cache hit?

The middleware stamps x-middleware-ran-at on the way out. If that stamp is older than the request, it came out of the cache with the HTML — the middleware did not run.

x-vercel-cache
x-middleware-ran-at
HTML rendered at
verdictclick "Probe /"

2. Does a middleware redirect still guard /protected?

Middleware redirects /protected to /login unless therepro_session cookie is set. Toggle the cookie, probe, then toggle back and probe again: on a broken build both answers come from whichever one got cached first.

session cookie
GET /protected
verdictclick "Probe /protected"

3. Does isr.exclude still exclude?

/live/[id] is matched by a RegExp inisr.exclude, and its pattern overlaps nothing else. Two requests must render twice: if the timestamps match, the middleware forwarded an excluded route into the cache.

first render
second render
verdictclick "Probe /live/42"

4. Is the query string part of the cache key?

/?probe=1 and /?probe=2 are the same cached page. Different timestamps mean each query string built its own entry, so the cache fragments per URL.

/?probe=1
/?probe=2
verdictclick "Probe query strings"

5. Is the cache still saving the render?

This page sleeps 1500ms before rendering. "Measure" times a forced re-render (request carrying the bypass token) against a normal cached request.

uncached render
cached request
verdictclick "Measure"