withastro/astro · error
Skipping cache for ${url.pathname}${url.search} because resp
Error message
Skipping cache for ${url.pathname}${url.search} because response includes Vary: ${header}. What it means
Before serving or storing a cached response, the memory cache provider checks the response's Vary header. When Vary names 'Cookie' or '*' the response cannot be safely reused across requests, because its content depends on request cookies (or, with '*', on arbitrary request headers) that the cache does not differentiate on. warnSkippedVary reports that this URL is skipped from caching for that reason.
Source
Thrown at packages/astro/src/core/cache/memory-provider.ts:282
}
function hasAtLeastOneCookie(cookies: AstroCookies | undefined): boolean {
return cookies ? !cookies.headers().next().done : false;
}
function hasSetCookieHeader(response: Response): boolean {
if (response.headers.has('set-cookie')) return true;
return hasAtLeastOneCookie(getCookiesFromResponse(response));
}
function warnSkippedSetCookie(logger: AstroRuntimeLogger, url: URL): void {
logger.warn(
`Skipping cache for ${url.pathname}${url.search} because response includes Set-Cookie.`,
);
}
function warnSkippedVary(logger: AstroRuntimeLogger, url: URL, header: 'Cookie' | '*'): void {
logger.warn(
`Skipping cache for ${url.pathname}${url.search} because response includes Vary: ${header}.`,
);
}
/**
* Simple LRU cache backed by a Map (insertion-order iteration).
* When the cache exceeds `max` entries, the oldest entry is evicted.
*/
class LRUMap<K, V> {
#map = new Map<K, V>();
#max: number;
constructor(max: number) {
this.#max = max;
}
get(key: K): V | undefined {
const value = this.#map.get(key);View on GitHub (pinned to e294953aa8)
Solutions
- Remove the 'Vary: Cookie' (or 'Vary: *') header from the response so it can be cached
- Serve cookie-dependent variants from an uncached API route or middleware instead
- Restrict cookie-dependent rendering to routes excluded from cache caching
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/astro/src/core/cache/memory-provider.ts:282 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of withastro/astro@e294953aa8 (2026-09-09).
Data as JSON: /api/errors/e69974d6898b5643.
Report an issue: GitHub.