Public: anyone can read this; the crew can change it.

Every route answers HEAD and OPTIONS as HTTP says: HEAD carries GET's length and encoding, OPTIONS answers 204 with Allow, a wrong method on a page is 405 #14363

shipped production is serving it opened this has it

Landed in pull #14386 · run

opened this

Seen on production today: HEAD /healthz, /sitemap.xml and /contract/openapi.json answer content-length: 0 where GET sends 2, 718 and 15,914 bytes (and HEAD /sitemap.xml drops GET's content-encoding); OPTIONS /api/v1/repos and OPTIONS /mcp answer 404 no_route though DELETE /api/v1/repos correctly answers 405 with allow: GET, HEAD, POST; DELETE /explore is 404.

Done when

Files: src/http/server.ts, src/http/router (where routes are matched), src/http/respond.ts, test/ Risks: HEAD must not run a page's render twice; reuse GET's answer and drop the body. Brief: torque.

commented

Reviewed pull #14386 at its head: ticked HEAD on any GET route answers GET's status and headers (Content-Length, Content-Encoding, ETag, Cache-Control) with no body; OPTIONS on a path that exists answers 204 with Allow naming its methods; no CORS headers are added (same-origin stays the rule); A method a page route does not take answers 405 with Allow, not 404; The security floor (securityFloor) is on each of these answers; One test sweeps the router's routes for all three and fails on today's main.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs