-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
[Bug] openai-codex provider blocked by Cloudflare JS Challenge when accessed via proxy in mainland China #67670
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Environment
Problem
The
openai-codexprovider (chatgpt.com/backend-api) is completely unusable when accessed from mainland China through any proxy node. Cloudflare returns 403 withcf-mitigated: challengeheader, blocking all requests before they reach ChatGPT backend.Root Cause
Cloudflare detects Node.js native fetch TLS fingerprint (JA3/JA4) as non-browser traffic and triggers a JS Challenge. This happens regardless of:
94.177.131.104, Canada23.132.28.49, multiple IPs)Key evidence: Using Python
cloudscraperlibrary (which mimics Chrome TLS fingerprint) with the same proxy and same OAuth token returns 200 OK successfully. This confirms the issue is purely TLS fingerprint-based detection.Error Messages Observed
LLM request failed: DNS lookup for the provider endpoint failed.— misleading; actually Cloudflare 403 HTML responseAuthentication failed with an HTML 403 response from the provider.— Cloudflare challenge, not auth failureLLM request failed: network connection error.— timeout variantblocked URL fetch (url-fetch) target=https://chatgpt.com/backend-api/responses reason=Blocked hostname or private/internal/special-use IP address— SSRF guard blocks VPN fake-DNS IPs (e.g. 198.x.x.x from Loon/QX)Additional Context
request.allowPrivateNetwork: trueresolves that layer, but the Cloudflare TLS fingerprint block remains.Workaround
Deploy a local Python reverse proxy using
cloudscraperto bypass Cloudflare TLS fingerprint detection:Install cloudscraper:
python3 -m venv /tmp/cftest && /tmp/cftest/bin/pip install cloudscraperRun a local HTTP reverse proxy (port 18792) that forwards requests to
chatgpt.com/backend-apivia cloudscraper with Chrome TLS fingerprint emulation.Configure OpenClaw to route openai-codex through the local proxy:
{ "models": { "providers": { "openai-codex": { "baseUrl": "http://127.0.0.1:18792", "models": [], "request": { "allowPrivateNetwork": true } } } } }Restart gateway:
openclaw gateway restartSuggested Fix
Consider one of:
undiciwith custom TLS settings or a bundledtls-client)request.tlsProfileoption (e.g."chrome") for providers that need Cloudflare bypass