chadtmiller.com/monolith
An atproto PDS
0
0
Browsers: CORS on every path but OAuth's, as the reference answers
Merged Approved
This adds a router-level CORS layer (cors.rs). OAuth paths pass through to their own CORS. Any OPTIONS gets a 204 preflight with the listed headers. Every other answer gets Access-Control-Allow-Origin: *. The pull also adds the "Browsers" section to spec/PDS.md and a cors harness step that compares status, all Access-Control-* headers, Vary and body emptiness against the reference.
- Spec and code agree. The spec's header values, the "no rate limit, no
RateLimit-*, not forwarded" claim and the OAuth path list all match the layer. - Harness. The check compares against the reference and loosens nothing. It is added to the step list with a weight.
- Source rules. No source or crates from the reference or an SDK are used.
conformance.yaml. The pull doesn't touch it.- README. It has no mention of CORS. If it lists what the server answers, one line on browser access would fit. I wouldn't hold the pull for that.
- Checks. The
gatesrun was still running when I looked, so I couldn't read a result.
Merged as e184912
Apps in a browser, such as bsky.app on the web, can now call the server: every answer allows any origin, and an
OPTIONSpreflight answers204, as the reference's do. Before, the browser blocked every call, and bsky.app's sign-in said "Unable to contact your service".Claude Opus 5.5 · high
What changes
Spec.
spec/PDS.mdgains "Browsers": on every path but OAuth's (whose cross-origin answersOAUTH.mdandOAUTH-MCP.mdalready give):Every answer, of any status, carries
Access-Control-Allow-Origin: *.Any
OPTIONSis a preflight:204, no body, with these headers:Allow-Origin: *;Allow-Methods: GET,HEAD,PUT,PATCH,POST,DELETE;Allow-HeadersechoingAccess-Control-Request-Headers;Max-Age: 86400;Vary: Access-Control-Request-Headers.It reaches no method, so it costs no rate limit and is not forwarded.
All of this matches what the reference was seen to answer.
Harness.
checks/cors.mjs, thecorsstep:200,4xxand404, with anOriginand without._health, a path that is no NSID and a path outside/xrpc/, with and withoutAccess-Control-Request-MethodandAccess-Control-Request-Headers.Access-Control-*header, whether a preflight'sVarynamesAccess-Control-Request-Headers, and whether its body is empty.Server.
cors.rs, a layer on the router, so preflights are still logged and counted under their route; OAuth's paths pass through to their own CORS.Why
The spec said nothing about CORS outside OAuth, so the harness never asked. Native apps, the CLI and MCP clients don't need it, but every web app does. A layer on the router, rather than in each handler, covers paths served and not served alike, as the reference's does.
How it was checked
204with the CORS headers, the server400with none.Access-Control-Request-Headers. The check fails at step 2. Put back.compare.mjs --steps 60 --seed 31 --only corsagrees, and the OAuth endpoints' ownOPTIONSanswers still do;just quickpasses here.just gatesis left to the pull'sgatesworkflow.Shortcomings
plc.directoryand an AppView configured. A server on a private PLC, as the staging one is, still won't work in bsky.app.