Feature Request: Geo-Aware Bucket Routing
还没有人认领这个 Issue。
评估
调研方向
首先跟踪 Cloudflare Workers 的请求路径,以及当前 bucket 配置如何选择 backend。检查提议的 cf.country 输入、只读 scope,以及 exact-country/region/primary 的优先级。在为 GET、HEAD 和 LIST 定义好配置和路由行为,同时写入仍保留在主 backend 上时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Summary
Add support for routing read requests to different backend storage providers based on the client's geographic location or credentials. This would allow a single virtual bucket (e.g., statistical) to be served from the nearest replica — reducing latency and improving download speeds for users worldwide.
Motivation
For a data portal like dataforcanada.org, datasets are accessed globally. Currently, each virtual bucket maps to exactly one backend. A client in Tokyo downloading from a Source Cooperative bucket in us-west-2 experiences high latency. With geo-routing, that same request would be served from a Tigris bucket in Tokyo or an R2 bucket in Asia-Pacific.
Proposed Behavior
A new configuration section would map (bucket, country/region) pairs to alternative backend configs. When a read request arrives, the proxy checks the client's location (available via Cloudflare's cf.country on Workers) and routes to the nearest replica. Writes would continue to go to the primary backend.
flowchart TD
JP["Client in Japan 🇯🇵"] -->|"GET /statistical/data.parquet"| Worker["CF Worker - s3.dataforcanada.org"]
CA["Client in Canada 🇨🇦"] -->|"GET /statistical/data.parquet"| Worker
DE["Client in Germany 🇩🇪"] -->|"GET /statistical/data.parquet"| Worker
AU["Client in Australia 🇦🇺"] -->|"GET /statistical/data.parquet"| Worker
PL["Client in Poland 🇵🇱"] -->|"GET /statistical/data.parquet"| Worker
Worker --> GeoMW{"Geo-Router - Middleware"}
GeoMW -->|"🇯🇵 JP → Tigris Tokyo (nrt)"| Tigris["Tigris Data - Tokyo"]
GeoMW -->|"🇨🇦 CA → Primary"| SC["Source Cooperative - us-west-2"]
GeoMW -->|"🇩🇪 DE → R2 Western Europe (weur)"| R2WEUR["Cloudflare R2 - Western Europe"]
GeoMW -->|"🇵🇱 PL → R2 Eastern Europe (eeur)"| R2EEUR["Cloudflare R2 - Eastern Europe"]
GeoMW -->|"🇦🇺 AU → R2 Oceania (oc)"| R2OC["Cloudflare R2 - Oceania"]
Example Configuration
# Primary bucket (default — North America)
[[buckets]]
name = "statistical"
backend_type = "s3"
anonymous_access = true
backend_prefix = "dataforcanada/d4c-datapkg-statistical/"
[buckets.backend_options]
bucket_name = "us-west-2.opendata.source.coop"
endpoint = "https://s3.us-west-2.amazonaws.com"
region = "us-west-2"
skip_signature = "true"
# Geo overrides for the "statistical" bucket
[geo_routing.statistical]
# Japan → Tigris Tokyo
[geo_routing.statistical.JP]
backend_type = "s3"
endpoint = "https://t3.storage.dev"
bucket_name = "d4c-datapkg-statistical"
region = "nrt"
# Asia-Pacific (fallback for other APAC countries) → R2 Asia-Pacific
[geo_routing.statistical.apac]
backend_type = "s3"
endpoint = "https://<account>.r2.cloudflarestorage.com"
bucket_name = "d4c-datapkg-statistical-apac"
region = "apac"
# Western Europe → R2 Western Europe
[geo_routing.statistical.weur]
backend_type = "s3"
endpoint = "https://<account>.r2.cloudflarestorage.com"
bucket_name = "d4c-datapkg-statistical-weur"
region = "weur"
# Eastern Europe → R2 Eastern Europe
[geo_routing.statistical.eeur]
backend_type = "s3"
endpoint = "https://<account>.r2.cloudflarestorage.com"
bucket_name = "d4c-datapkg-statistical-eeur"
region = "eeur"
# Oceania → R2 Oceania
[geo_routing.statistical.oc]
backend_type = "s3"
endpoint = "https://<account>.r2.cloudflarestorage.com"
bucket_name = "d4c-datapkg-statistical-oc"
region = "oc"
Resolution Priority
When a request arrives from a specific country, the geo-router should resolve in this order:
- Exact country match — e.g.,
JP→ Tigris Tokyo - Region match — e.g., other APAC countries → R2 Asia-Pacific
- Primary backend — fallback to the default bucket config (Source Cooperative)
Scope
- Reads only (GET, HEAD, LIST) — writes should always go to the primary backend
- Cloudflare Workers — the
cf.countryfield is readily available on every request - Server runtime — could use GeoIP lookup on
source_ipas a future extension
- 主要语言
- Rust
- 星标
- 21
- 派生
- 1
- 平均合并
- 16 小时 39 分钟
- 30 天内合并 PR
- 1
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
developmentseed/multistore 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
developmentseed/multistore#160 ·
-
Support UploadPartCopy (multipart server-side copy): AWS CLI and boto3 use it for any copy over 8 MB未关闭enhancement
难度 4/5 3-5 天 新手友好度 48/100
developmentseed/multistore#168 ·
-
List of a prefix 503s when a single object key contains an empty path segment (//)可能已有人在做 @alukach 于 127 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 55/100
developmentseed/multistore#116 · 1 条评论 ·
-
enhancement
难度 4/5 3-5 天 新手友好度 68/100
-
oidc-provider: optional `oidc_session_name` backend-option to override RoleSessionName derivation未关闭
难度 2/5 1-3 小时 新手友好度 35/100
查看 developmentseed/multistore 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
storytold/craft-anything#2472 ·
维护者通常 1 天内回复
-
enhancement good first issue help wanted
难度 2/5 1-3 小时 新手友好度 78/100
getsotto/sotto-authenticator#68 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
slavakurilyak/awesome-ai-agents#1046 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
nowledge-co/hawdb#1995 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
swc-project/swc-next-issues#984 ·