Skip to content

405 Responses And Allow Header #296

Closed

Description

@thehabes

RFC 9110 §15.5.6 requires Allow on a 405.

Related, on the 200 path: configureWebAnnoHeadersFor() emits Allow: GET,OPTIONS,HEAD,PUT,PATCH,DELETE,POST, advertising methods some routes reject with 405.

We are noticing that the 405 response codes occur as expected but their Allow header value can be missing or incorrect. Check all instances of where a 405 is returned and the resulting 'Allow' header. Line up the 'Allow' header value with the actual list of allowed methods. Do not emit method names that are not allowed.

Activity

  1. thehabes commented on Sep 24, 2026

    @thehabes
    MemberAuthor

    Resolved by #295 (fix: include accurate Allow headers on 405 responses), merged to main as 5702087. The branch was named for #287 and the merge body did not reference this issue, so it stayed open.

    Verified against a running instance. All 20 405 fallbacks emit an Allow header whose value matches the verbs actually registered on that route:

    Path Allow
    /v1/api/query POST,HEAD
    /v1/api/search, /v1/api/search/phrase POST
    /v1/id/:_id GET,HEAD
    /v1/id/:_id/expanded GET,POST,HEAD
    /v1/since/:_id, /v1/history/:_id GET,HEAD
    /v1/api/create, /v1/api/bulkCreate POST
    /v1/api/update, /v1/api/overwrite, /v1/api/bulkUpdate PUT
    /v1/api/patch, /v1/api/set, /v1/api/unset PATCH,POST
    /v1/api/release/:_id PATCH
    /v1/api/delete/:_id DELETE
    /gog/id/:_id GET,HEAD
    /gog/fragmentsInManuscript, /gog/glossesInManuscript POST

    No method is advertised that the route rejects. Every HEAD in the table above returns a 200 against a real object, including HEAD /v1/api/query via controller.queryHeadRequest. POST on the patch routes is genuinely supported through X-HTTP-Method-Override.

    The 200-path concern is handled too: configureWebAnnoHeadersFor() in utils.js no longer emits Allow. The only remaining writes of that header in non-test code are the two 405 emitters in rest.js.

    Regression coverage is in routes/__tests__/route_wrappers.test.js, which table-drives all 20 routes and derives the expected Allow from each router's own route.methods rather than hard-coding strings, so a route that gains or loses a verb without updating its fallback will fail. Full suite passes at 240/240.

    Two smaller Allow accuracy gaps that fall outside the scope of this issue are tracked in #318.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions