Skip to content

Commit 1e95ef5

Browse files
committed
fix: CORS wildcard Allow-Headers for Firefox compatibility (closes #158)
1 parent c71451a commit 1e95ef5

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
### Fixed
1010

11+
- **CORS: Firefox preflight blocked by restricted `Allow-Headers`** — Changed `Access-Control-Allow-Headers` from `Content-Type, Authorization` to wildcard `*`, fixing Firefox's strict CORS enforcement when the OpenAI SDK sends `User-Agent` in the preflight. (Issue #158)
1112
- **GitHub Action: cosmetic binary rename**`action.yml` fixtures branch referenced the legacy `llmock` binary (still functional); updated to `aimock` for consistency
1213
- **GitHub Action: hardcoded URLs in docs examples** — All workflow examples now use `steps.<id>.outputs.url` instead of hardcoded `http://127.0.0.1:4010`
1314

src/__tests__/server.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ describe("CORS", () => {
607607
expect(res.status).toBe(204);
608608
expect(res.headers["access-control-allow-origin"]).toBe("*");
609609
expect(res.headers["access-control-allow-methods"]).toContain("POST");
610+
expect(res.headers["access-control-allow-headers"]).toBe("*");
610611
});
611612

612613
it("includes CORS headers on 404 responses", async () => {

src/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ const DEFAULT_MODELS = [
160160
const CORS_HEADERS: Record<string, string> = {
161161
"Access-Control-Allow-Origin": "*",
162162
"Access-Control-Allow-Methods": "GET, POST, DELETE, OPTIONS",
163-
"Access-Control-Allow-Headers": "Content-Type, Authorization",
163+
"Access-Control-Allow-Headers": "*",
164164
};
165165

166166
function setCorsHeaders(res: http.ServerResponse): void {

0 commit comments

Comments
 (0)