This commit is contained in:
Mateusz Gruszczyński committed 2026-10-06 23:08:43 +02:00
1 parent 5d2aaeabe6
commit 9d6614c1b4
62 files changed
+558 -230

No files matched your search

+16
View File
@@ -278,6 +278,22 @@ async fn observe(State(state): State<Arc<App>>, mut request: Request, next: Next
{
response.headers_mut().remove("alt-svc");
}
// Cookie-bearing requests are normally excluded from compression to avoid
// compressing potentially private dynamic content. The cache can explicitly
// ignore cookies for configured static extensions, though; once that request
// is a shared-cache HIT, cache policy has already proven the stored response
// contains no Set-Cookie/private/no-store metadata. Local Web Server static
// responses are equally independent of request cookies. Allow compression in
// those two bounded cases so cached/static browser assets still negotiate
// Content-Encoding.
if original_headers.contains_key("cookie")
&& (exchange.cache_status.load(Ordering::Relaxed) == 1
|| response.extensions().get::<StaticSourceResponse>().is_some())
{
response
.extensions_mut()
.insert(crate::compression::AllowCookie);
}
response = crate::compression::encode(
response,
&original_headers,