Developer Platform von Cloudflare
Workers, Cloudflare CLI - Serve a Worker's static assets from a URL path like /blog/
You can now serve your Worker's static assets from a URL path prefix, such as example.com/blog/, without changing your build output.
Previously, to serve assets from /blog/, you had to nest your files in a matching blog directory. Now, set assets.base_path in your Wrangler configuration file, or worker.assets.basePath in cloudflare.config.ts, and keep your files at the root of your asset directory.
Use Wrangler 4.148.0 ↗︎ or later. With cloudflare.config.ts, use cf 1.0.0-beta.13 ↗︎ or later.
For example, this configuration serves your built assets from /blog/:
The following content appears twice: first for the Cloudflare CLI (cf), then for Wrangler. Use cf for new projects. In an existing project, use the CLI that the project already uses.
Cloudflare CLI
cloudflare.config.tsts
import { defineConfig } from "cf/config";
export default defineConfig({
worker: {
name: "blog",
// Set this to today's date
compatibilityDate: "2026-12-04",
assets: {
basePath: "/blog",
},
},
});
Wrangler
{
"$schema": "./node_modules/wrangler/config-schema.json",
"assets": {
"directory": "./dist",
"base_path": "/blog"
}
}
[assets]
directory = "./dist" …