Cloudflare Workers can now serve static assets from a URL prefix
A new assets.base_path option serves your built assets from a subpath like /blog without changing how your project is laid out on disk.
Cloudflare shipped assets.base_path for Workers Static Assets on 28 October, letting you serve a project’s built files from a URL prefix instead of the root, with no change to the directory structure on disk.
Set it in wrangler.jsonc:
{
"assets": {
"directory": "./dist",
"base_path": "/blog"
}
}
That serves the contents of ./dist from /blog/ rather than /. The same option is available as worker.assets.basePath in cloudflare.config.ts. It needs Wrangler 4.148.0 or later, or cf 1.0.0-beta.13 or later if you’re using the newer config format.
Why it matters: mounting a static Worker under a subpath used to mean restructuring your build output or adding routing logic to fake it. This makes it a one-line config change, which matters if you’re running several small Workers-hosted sites or apps behind a single domain, each on its own path.