This commit is contained in:
Mateusz Gruszczyński committed 2026-11-28 17:36:53 +01:00
1 parent 5b6d4a7903
commit 4d1087e357
160 files changed
+2407 -1933

No files matched your search

+3 -14
View File
@@ -54,10 +54,6 @@ impl Plan {
self
}
}
/// For cookie-independent static files only: remove Cookie from the Vary schema
/// presented to both RustProxy and downstream caches. A backend's public cache
/// policy must be explicit; private/Set-Cookie/no-store responses are untouched.
/// The caller is responsible for applying this only to configured static paths.
pub fn normalize_static_cookie_vary(
status: StatusCode,
headers: &mut HeaderMap,
@@ -106,9 +102,6 @@ pub fn normalize_static_cookie_vary(
};
candidate.insert(::http::header::VARY, value);
}
// A response may have a storage plan with zero freshness (e.g. `public`
// with no fallback TTL, or `max-age=0`). Such a response must retain the
// origin's Vary: Cookie. The same applies when reuse needs revalidation.
let Some(plan) = plan_with(status, &candidate, settings, response_delay, overrides) else {
return false;
};
@@ -187,8 +180,6 @@ pub fn plan_with(
if !forced && settings.varnish_compatible && surrogate_no_store(headers) {
return None;
}
// Explicit compatibility-mode fallback overrides origin no-cache even when
// it does not contain public. Strict mode always follows RFC 9111.
let override_no_cache = settings.varnish_compatible
&& control.contains_key("no-cache")
&& (settings.default_ttl_seconds > 0 || overrides.ttl.is_some_and(|ttl| ttl > 0));
@@ -232,11 +223,9 @@ pub fn plan_with(
.ok()?
.as_secs(),
)
} else if control.contains_key("public") {
Some(settings.default_ttl_seconds)
} else if settings.varnish_compatible && settings.default_ttl_seconds > 0 {
// In compatibility mode a configured default TTL can also be used
// for headerless, otherwise eligible 200s (Varnish default_ttl style).
} else if control.contains_key("public")
|| (settings.varnish_compatible && settings.default_ttl_seconds > 0)
{
Some(settings.default_ttl_seconds)
} else {
None