Skip to content

Fix duplicate CORS headers on proxied responses#63

Merged
motatoes merged 1 commit intomainfrom
fix/duplicate-cors-headers
Mar 13, 2026
Merged

Fix duplicate CORS headers on proxied responses#63
motatoes merged 1 commit intomainfrom
fix/duplicate-cors-headers

Conversation

@motatoes
Copy link
Contributor

Summary

  • Both the API server and worker run Echo's CORS middleware, each adding Access-Control-Allow-Origin: *
  • When the API proxies worker responses, it forwards all headers via Add(), resulting in duplicate *, * which browsers reject as invalid CORS
  • Fix: skip Access-Control-* headers when forwarding proxied responses — the outer server's own CORS middleware already handles these

Test plan

  • Verify browser requests to /api/sandboxes/{id}/files no longer get duplicate CORS headers
  • Verify WebSocket connections still work through the proxy
  • Verify cross-origin requests from openlovable studio succeed

🤖 Generated with Claude Code

The API server's CORS middleware adds Access-Control-Allow-Origin: *,
and the worker's CORS middleware does the same. When the API proxies
worker responses, it forwards all headers including CORS ones via Add(),
resulting in duplicate "*, *" which browsers reject.

Skip Access-Control-* headers when forwarding proxied responses — the
outer server's own CORS middleware already handles these.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
opensandbox Ready Ready Preview, Comment Mar 13, 2026 3:14am

Request Review

@motatoes motatoes merged commit dfdbe1f into main Mar 13, 2026
3 checks passed
@github-actions
Copy link

Preview Environment Destroyed

The preview environment dev-pr-63 has been torn down.
All AWS resources for this environment have been cleaned up.

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.

1 participant