Catalog / Cloudflare Developer Platform

Workers, Cloudflare CLI - Serve Workers Static Assets from a URL path prefix

todayOriginal notes

Workers Static Assets can now serve assets from a URL path prefix without changing their directory structure. Set assets.base_path in Wrangler, or worker.assets.basePath in cloudflare.config.ts.

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/:

Select your preferred CLIWranglerCFChanges examples on this page to use the selected CLI.
{
  "$schema": "./node_modules/wrangler/config-schema.json",
  "assets": {
    "directory": "./dist",
    "base_path": "/blog"
  }
}
[assets]
directory = "./dist"
base_path = "/blog"
cloudflare.config.tsts
import { defineConfig } from "cf/config";

export default defineConfig({
worker: {
  name: "blog",
  // Set this to today's date
  compatibilityDate: "2026-10-28",
  assets: {
    basePath: "/blog",
  },
},
});

With Wrangler, assets.directory selects the directory to serve. With cloudflare.config.ts, your build configuration supplies the assets.

To configure the option, refer to Serving a subdirectory.