Skip to content

Reach mainland China hosts through the general proxy's mainland zone - #102

Merged
Digidai merged 1 commit into
mainfrom
mainland-zone
Nov 21, 2026
Merged

Digidai merged 1 commit into
mainfrom
mainland-zone

Conversation

@Digidai

@Digidai Digidai commented Nov 21, 2026

Copy link
Copy Markdown
Owner

What changes

A mainland China host that times out is retried through a proxy that exits in mainland China (#101). Until now that needed its own credentials in PROXY_POOL_MAINLAND. With the plain var PROXY_MAINLAND_ZONE, the general proxies are reused instead: the exit zone in each proxy username (..._zone_US) is switched to that zone.

  • PROXY_POOL_MAINLAND still wins when it names a proxy.
  • A username without a zone has no exit to switch. That proxy is left out, so nothing is retried and no anonymous budget is spent.
  • wrangler.toml sets PROXY_MAINLAND_ZONE = "CN".
  • /admin shows the mainland card as active when either setting is present.

This is a trial

Not verified before merge, because the proxy credentials exist only in production:

  • whether the configured proxy username carries a zone at all,
  • whether the proxy account has exits in mainland China,
  • whether such an exit answers within the 9 seconds each attempt gets.

After deploy, the proxy_pool_mainland row in provider_attempts_daily and the conversion log show which of these holds. If the zone does not work, the var comes out again; the cost until then is the 20-second retry that production had before #101.

Known limit either way: the proxy path speaks TLS 1.3 only, and 15 of 31 mainland https hosts probed offer TLS 1.2 at most.

Verification

  • npx vitest run: 951 tests pass. Typecheck passes for the Worker and web/.
  • "switches the general proxy to the mainland zone when no mainland proxy is named" fails when the zone is not switched, and when a username without a zone is kept.
  • "prefers the named mainland proxies over a switched zone" fails when the zone wins.
  • wrangler.toml parses with the new [vars] table; the Worker had no plain vars before.

Without PROXY_POOL_MAINLAND, the plain var PROXY_MAINLAND_ZONE reuses the
general proxies for a mainland host that timed out: the exit zone in each
proxy username is switched to that zone. A username without a zone is left
out, so nothing is retried and no budget is spent.

The var is set to CN.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T12:36:20.422115Z 518aad5 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.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
website2markdown 518aad5 Nov 21 2026, 12:35 PM

@Digidai
Digidai merged commit d01caa9 into main Nov 21, 2026
2 checks passed
@Digidai
Digidai deleted the mainland-zone branch November 21, 2026 12:37
Digidai added a commit that referenced this pull request Nov 21, 2026
* Revert "Append the mainland zone to a proxy username that names no zone (#103)"

This reverts commit 45d3965.

* Revert "Reach mainland China hosts through the general proxy's mainland zone (#102)"

This reverts commit d01caa9.
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