Skip to content
Back to feed

November 11, 2026 · 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-11-12",
  assets: {
    basePath: "/blog",
  },
},
});

Wrangler

{
  "$schema": "./node_modules/wrangler/config-schema.json",
  "assets": {
    "directory": "./dist",
    "base_path": "/blog"
  }
}
[assets]
directory = "./dist"
base_path = "/blog"

Requests to /blog/ serve dist/index.html, and requests to /blog/posts/post1 serve dist/posts/post1.html. Requests outside /blog/ do not match your static assets and run your Worker, if it has one.

Paths in _headers, _redirects, and run_worker_first use the full public path, including /blog. If you build with the Cloudflare Vite plugin, also set Vite's base option to /blog/.

For more information, refer to Serving a subdirectory.

All Workers changes