feat: Add POST and OPTIONS support to CORS proxy#64
Merged
Conversation
Widgets that need to make POST requests through the proxy (e.g. OAuth2 token exchange) were getting 405s. Add OPTIONS handler for CORS preflight, POST handler that forwards body/content-type upstream without caching, and update the chat system prompt to document both methods.
Owner
Author
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Error responses from validateTarget, scanTarget, and catch blocks were missing Access-Control-Allow-Origin, causing the browser to block widgets from reading the error body after a successful OPTIONS preflight.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
OPTIONShandler for CORS preflight responses (204 with appropriateAccess-Control-Allow-*headers)POSThandler that forwards request body andContent-Typeupstream, with no caching or inflight deduplication (POST is not idempotent)validateTarget,scanTarget)Test plan
OPTIONS /api/proxy?url=...returns 204 with correct CORS headersPOST /api/proxy?url=...forwards body and content-type to upstream and returns the responseGET /api/proxy?url=...still works as before (caching, dedup, stale-while-revalidate)