Skip to content

fix(cors): allow PATCH and the client headers under the restricted policy - #1391

Merged
iammukeshm merged 3 commits into
mainfrom
fix/cors-restricted-policy-headers
Sep 25, 2026
Merged

iammukeshm merged 3 commits into
mainfrom
fix/cors-restricted-policy-headers

Conversation

@iammukeshm

Copy link
Copy Markdown
Member

With CorsOptions:AllowAll=false (the shipped appsettings.json and appsettings.Production.json), the browser rejects preflights from both React apps. Dev hides this because appsettings.Development.json sets AllowAll=true.

Changes

  1. PATCH in AllowedMethods — cherry-picked from fix(cors): allow PATCH in restricted policy #1371 by @CattonNyan (authorship kept). Fixes CORS: PATCH is missing from AllowedMethods, blocking existing PATCH APIs under the restricted policy #1370.
  2. Missing request headers in AllowedHeaders — fixes CORS: the mandatory 'tenant' header is missing from CorsOptions.AllowedHeaders, breaking both front-ends under the restricted policy #1367. The restricted list was only content-type, authorization:
Header Sent by
tenant every call from both apps (api-client.ts)
x-fsh-app login (auth/api.ts)
idempotency-key chat send
x-requested-with, x-signalr-user-agent @microsoft/signalr negotiate

Config-file regression tests cover both shipped files; they fail without the header change (10 red) and pass with it.

Upgrade note: deployers who override CorsOptions:AllowedHeaders must add these headers, or login and realtime fail under restricted CORS.

Supersedes #1371 (its CI ran on a base from before the dependency advisory fixes, so it can't go green as-is).

🤖 Generated with Claude Code

CattonNyan and others added 3 commits September 25, 2026 07:13
…olicy

The restricted policy only allowed content-type and authorization, so with
CorsOptions:AllowAll=false the browser rejects the preflight for:
- tenant (every API call from both apps)
- X-FSH-App (login)
- Idempotency-Key (chat sends)
- X-Requested-With / X-SignalR-User-Agent (SignalR negotiate)

Fixes #1367.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@iammukeshm
iammukeshm merged commit dcb3525 into main Sep 25, 2026
16 checks passed
@iammukeshm
iammukeshm deleted the fix/cors-restricted-policy-headers branch September 25, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants