Date: 2026-08-13 08:03 Summary: Path /{lang} cannot DNS-map to R2; implement via Worker Cache→R2 or a separate R2 host.
[question] https://onlinefreetools.org/{lang} 能否配置指向R2,如果可以改R2,怎么实现
[try to solve]
Conclusion: you cannot point only the path /{lang} on the apex host at R2 via DNS or an R2 custom domain. Custom domains are hostname-scoped, and onlinefreetools.org already serves Pages, so you cannot attach an R2 custom domain on the same host for path-based routing. The workable approach is a Worker that reads from R2.
Option A (recommended if homes must come only from R2; small change): make serveHomeHtml skip Assets and use Cache→R2 _pages/{lang}/index.html.gz→gunzip (same as tool pages). upload:r2 already backs up home HTML; git-tracked public/{lang}/index.html can remain as fallback but is not required for hot updates. Cost: cold path similar to tool-page miss (~300ms).
Option B (change R2 layout): upload plaintext keys aligned to public paths such as zh/index.html (not .gz); Worker maps /{lang}/ to that key. Still requires a Worker; DNS alone cannot do it. A public bucket / custom domain only fits a separate subdomain (e.g. pages-cdn…) and cannot take over apex /{lang}.
Option C: R2 custom domain on a subdomain — does not solve onlinefreetools.org/{lang}.
Do not restructure R2 only for homes; Assets-first is better today. If choosing A, change r2Pages.serveHomeHtml plus docs/ops; no bucket-binding change needed.
[actions]
- Read-only design note; no code changes