fix(cors): re-enable credentials on chat/form embed CORS policy#4673
Conversation
Chat and form embeds authenticate via the chat_auth_<id> / form auth cookie set by setDeploymentAuthCookie. The previous PR set Access-Control-Allow-Credentials: false on these routes, which made the browser drop the auth cookie and produce 401s on subsequent embed calls after login. Restore credentials: true (matching pre-consolidation behavior) while keeping reflected origin and Vary: Origin. The wildcard fallback when Origin is absent now also drops credentials to stay CORS-spec-compliant. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Keeps the CORS-spec invariant by dropping credentials when Reviewed by Cursor Bugbot for commit f8ac423. Configure here. |
Greptile SummaryThis PR restores
Confidence Score: 5/5Safe to merge — the change correctly restores cookie delivery for protected embed routes without breaking the wildcard-fallback invariant. The fix is narrow and well-targeted: a single expression ( No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "chore(cors): restore concise TSDoc on pr..." | Re-trigger Greptile |
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit f8ac423. Configure here.
Summary
PR #4658 set `Access-Control-Allow-Credentials: false` on `/api/chat/[identifier]/` and `/api/form/[identifier]/` under the (wrong) assumption that those routes authenticate via signed tokens rather than cookies. They actually authenticate via the `chat_auth_` / form auth cookie set by `setDeploymentAuthCookie`. With `Allow-Credentials: false`, the browser drops the cookie on subsequent embed calls after login, producing 401s on password / email-OTP / SSO-protected embeds.
Restore the pre-consolidation behavior: reflected origin + `Allow-Credentials: true` on embed routes. Wildcard fallback (Origin header absent) still drops credentials to stay CORS-spec-compliant.
Verification
Test plan