Skip to content

fix: resolve Sandbox proxy 502 in Cloudflare Workers - #27

Merged
sam2tom merged 1 commit into
mainfrom
codex/sandbox-worker-redirect
Sep 29, 2026
Merged

sam2tom merged 1 commit into
mainfrom
codex/sandbox-worker-redirect

Conversation

@sam2tom

@sam2tom sam2tom commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Sandbox Playground requests fail in Cloudflare Workers before reaching the upstream because Workers rejects redirect: "error". The proxy catches that TypeError and returns 502 request_failed_result_unknown, even though direct v2 template discovery succeeds.

Use redirect: "manual" and explicitly reject every 3xx response on both the sandbox access check and final upstream request. Return a safe 502 without forwarding Location, cookies, or upstream bodies; credentials never follow a redirect.

Validation:

  • Actual proxy source reproduced the exact 502 in local workerd; the fixed source returned 200 with a synthetic template response. Local runtime compatibility date: 2026-08-06; deployment configuration is unchanged.
  • 14 Sandbox tests and Worker routing tests passed, including 301/302/303/307/308 responses at the control, access-check, and data stages.
  • Read-only direct production v2 discovery returned 200 with four templates. The terminal's request to the public docs route returned a separate non-JSON 403, so a deployed end-to-end success is not yet claimed.

No deployment or Sandbox resource mutations performed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T06:33:35.949641Z 23af56c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sam2tom
sam2tom merged commit 99c8e4b into main Sep 29, 2026
1 check passed
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