Skip to content

Routing

oc run 在已运行的平台上激活部署,然后打印该 Worker 的默认 platform_path URL(平台 origin + path prefix)。默认 origin 是 http://127.0.0.1:8787

sh
bun run oc run --config examples/hello-worker/open-compute.json --ocd "$PWD/target/debug/ocd"
# Worker is serving at http://127.0.0.1:8787/<path>

HTTP 请求到达绑定了该 Worker 的路径后,由 fetch handler 处理。Static Assets 的 HTML trailing-slash / SPA / Worker-first 路由概念与 Cloudflare Static Assets routing 对齐,见 Static Assets

兼容性

主题Cloudflareopen-compute
绑定路径上的 HTTP 由 fetch 处理
Static Assets HTML trailing-slash / SPA / Worker-first是,见 Static Assets
Custom Domains不提供
workers.dev不提供
Cloudflare zone Routes / Page Rules不提供
项目文件中的 routes / workers_dev不允许
预览 URL*.workers.dev / Cloudflare previewoc run 打印的本机 URL
部署与路由数据源Cloudflare 控制面本机 SQLite;ocd 监督当前 workerd 进程