This commit is contained in:
Mateusz Gruszczyński committed 2026-10-06 23:54:01 +02:00
1 parent 9d6614c1b4
commit a9f9450f80
16 files changed
+171 -47

No files matched your search

+14
View File
@@ -219,6 +219,20 @@ fn apply_response_rules(
headers::strip_admin_set_cookie(headers);
}
}
fn apply_response_age_rules(
headers: &mut http::HeaderMap,
snapshot: &crate::config::Snapshot,
frontend: Option<&crate::config::CompiledFrontend>,
route: Option<&crate::config::CompiledRoute>,
) {
crate::headers::apply_wire_age(headers, &snapshot.headers.response);
if let Some(frontend) = frontend {
crate::headers::apply_wire_age(headers, &frontend.headers.response);
}
if let Some(route) = route {
crate::headers::apply_wire_age(headers, &route.headers.response);
}
}
/// Final policies apply to cache hits, errors, static pages and ALL transports.
fn finish_headers(
response: &mut Response,
+14
View File
@@ -87,6 +87,12 @@ async fn observe(State(state): State<Arc<App>>, mut request: Request, next: Next
&request_id,
&state.active_listeners,
);
apply_response_age_rules(
response.headers_mut(),
&snapshot,
frontend_context.as_deref(),
route_context.as_ref(),
);
return response;
};
state.metrics.active.fetch_add(1, Ordering::Relaxed);
@@ -356,6 +362,14 @@ async fn observe(State(state): State<Arc<App>>, mut request: Request, next: Next
cache.annotate_transformed(response.headers_mut(), transformed);
}
}
if !minimal_welcome {
apply_response_age_rules(
response.headers_mut(),
&snapshot,
frontend_context.as_deref(),
route_context.as_ref(),
);
}
if response
.extensions()
.get::<crate::pages::PageServed>()