You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FOCA's problem handler (_problem_handler_json in foca/errors/exceptions.py) builds error responses from the problem details, status and media type only. Headers that Werkzeug's HTTP exceptions carry are dropped, although standards require them:
405 Method Not Allowed: Allow (RFC 9110 §15.5.6).
401 Unauthorized: WWW-Authenticate (RFC 9110 §11.6.1; for bearer tokens RFC 6750 §3, e.g. Bearer error="invalid_token"), which clients use to tell "token expired, log in again" from other errors.
429 / 503: Retry-After, if set.
Found in the cloud-registry v0.3.0 pre-release review (e.g. POST /service-info returns 405 without Allow).
How?
Copy the headers from HTTPException.get_headers() into the problem response, except Content-Type (FOCA sets the problem media type).
Have FOCA's own token validation raise 401s with WWW-Authenticate: Bearer (with error="invalid_token" and a short error_description where the token was present but invalid, RFC 6750 §3.1), and realm if configured.
Tests for 405 (Allow), 401 (WWW-Authenticate), 503 with retry_after (Retry-After), and that Content-Type stays the problem media type.
Release notes entry; this goes into a patch release (0.15.1) so cloud-registry v0.3.0 can use it.
Acceptance criteria
Error responses keep the headers of the exception (except Content-Type); tests cover 405, 401 and 503.
401s from FOCA's auth carry WWW-Authenticate: Bearer ….
Activity
fix: address review of error headers
uniqueg commentedon Oct 21, 2026
Done in #349.