Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/cors-authorization-header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@getcirrus/pds": patch
---

Be explicit with CORS headers so browser-based authenticated XRPC calls work (particularly PDS Moover).

The CORS middleware advertised `Access-Control-Allow-Headers: *`, but this didn't cover the `Authorization` header needed by tools like PDS Moover. As a result, authed cross-origin requests from web clients (eg. PDS Moover's `com.pdsmoover.backup.getRepoStatus`) were blocked at preflight. This is now resolved; all headers are reflected back, just like the Bluesky implementation.
7 changes: 6 additions & 1 deletion packages/pds/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ app.use(
cors({
origin: "*",
allowMethods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
allowHeaders: ["*"],
// Omit allowHeaders: Hono reflects the browser's
// Access-Control-Request-Headers back, matching the reference
// atproto PDS (`cors({ maxAge })`). This allows Authorization
// (a `*` wildcard wouldn't), DPoP, atproto-proxy,
// atproto-accept-labelers, accept-language, x-bsky-topics and
// any future header automatically.
exposeHeaders: ["Content-Type"],
maxAge: 86400,
}),
Expand Down