Repository navigation
Description
Summary
An application can't add its own headers to the error responses EdgeZero renders for admitted requests. Middleware sees only Ok(Response), so a router miss, a 405, or a handler Err goes out without the headers the application puts on every other response.
Behavior today
App::dispatch_admitted_with_geopasses the request's Geo outcome to the handler context. When dispatch fails, it renders the error with the configured error renderer and builds the egress envelope (crates/edgezero-core/src/app.rs).- That rendered response never passes through application middleware. The application can't see it or change it.
- The error renderer receives only the
EdgeError. It has no access to the request's Geo outcome, so it can't derive Geo-dependent headers. - Trusted Server needs this on its native Axum path. Extract the protected CloudFront Geo baseline trusted-server#1532 removed its call because
rc/identitydoesn't have the API, so errors EdgeZero renders outside the router carry no Geo or Trusted Server headers.
Acceptance criteria
- An application can install an optional, synchronous finalizer that runs once on each rendered admitted dispatch error, after the error renderer.
- The finalizer receives the same
GeoOutcomethe request context received. EdgeZero doesn't resolve Geo again, and request headers or extensions the handler changed can't replace it. - EdgeZero keeps the failure classification, route and synthesized-response bookkeeping, and reapplies the rendered status and required protocol headers (for example
Retry-AfterandAllow) after the finalizer runs. - Successful responses (including application-returned error statuses), detached errors, pre-admission refusals and admitted body-conversion errors don't call the finalizer.
- With no finalizer installed, behavior is unchanged.
-
docs/guide/native-geo.mdexplains when to use middleware and when to use the finalizer.
Related
- The API comes from the AWS demo RC (
89c279b5) and is part of integration RC DO NOT MERGE: Axum integration RC #462 (Track review-stack AWS demo integration checkpoint #461). - The server-side identity plan (Add server-side identity on every adapter spec and plan trusted-server#1559) lists this work outside the Fastly and Axum MVP.
Metadata
Metadata
Assignees
Labels
No labels
Activity