Skip to content

fix(proxy): Handles CORS preflight OPTIONS#403

Open
yanziz-nvidia wants to merge 1 commit intomainfrom
yanziz/fix-websocket-rejection-options
Open

fix(proxy): Handles CORS preflight OPTIONS#403
yanziz-nvidia wants to merge 1 commit intomainfrom
yanziz/fix-websocket-rejection-options

Conversation

@yanziz-nvidia
Copy link
Copy Markdown
Contributor

@yanziz-nvidia yanziz-nvidia commented Apr 17, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced CORS (Cross-Origin Resource Sharing) support by improving the handling of OPTIONS preflight requests, enabling better cross-origin request compatibility.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d3e579e5-3f07-4b79-a770-243d32485ecd

📥 Commits

Reviewing files that changed from the base of the PR and between 47c119f and 3c49d44.

📒 Files selected for processing (1)
  • src/core/cloudxr/python/wss.py

📝 Walkthrough

Walkthrough

The change adds a monkey-patch function that intercepts ValueError exceptions from the websockets library's HTTP request parser when handling OPTIONS requests. The function parses the HTTP headers and returns a synthetic Request object with a special path ("/__cors_preflight__") instead of allowing the exception to propagate. This patch is activated at module import time, allowing the existing CORS response logic to handle preflight requests that would otherwise cause parser failures.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: implementing a solution to handle CORS preflight OPTIONS requests in the WebSocket proxy.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yanziz/fix-websocket-rejection-options

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@blongs-nv blongs-nv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants