workers: 固定 placement 到美区,规避部分 colo 出站被拦导致的 403/500#1
Open
sdsdsdff wants to merge 1 commit intoTQZHR:mainfrom
Open
workers: 固定 placement 到美区,规避部分 colo 出站被拦导致的 403/500#1sdsdsdff wants to merge 1 commit intoTQZHR:mainfrom
sdsdsdff wants to merge 1 commit intoTQZHR:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses production issues where Cloudflare Workers executing from certain APAC colos (e.g., SIN, some Taiwan routes) encounter upstream blocking when requesting the Grok API, resulting in 403/500 errors. The solution pins Worker execution to the US West region where requests succeed reliably.
Changes:
- Added placement configuration to
wrangler.tomlto pin Worker execution to theaws:us-west-2region, avoiding upstream blocks from certain APAC colos
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景:部署在 Cloudflare Workers 时,Worker 默认会在访问者就近的 colo 执行。
实测在部分 APAC colo(例如 SIN / 部分 TW 线路)下,Worker 出站请求 grok 上游会触发 Cloudflare Challenge(返回“Just a moment...”),导致 upstream 403,最终接口返回 500(upstream_error)。
而当请求落到 LAX 等美区 colo 时,同样请求可以稳定 200。
改动:在 wrangler.toml 增加 placement hint:
[placement]
region = "aws:us-west-2"
让 Worker 执行/出站更倾向美区,从而规避上述 upstream block(已在实际环境验证生效)。