sincecutoff.com
← all changes

Workers Static Assets supports a URL base path

Introduced 2026-10-28 · score 0.97

HOW TO USE IT

When static assets must be served under a URL 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, or cf 1.0.0-beta.13 or later for `cloudflare.config.ts`.

{"$schema":"./node_modules/wrangler/config-schema.json","assets":{"directory":"./dist","base_path":"/blog"}}
[assets] directory = "./dist" base_path = "/blog"
import { defineConfig } from "cf/config"; export default defineConfig({ worker: { name: "blog", compatibilityDate: "2026-10-28", assets: { basePath: "/blog" }, }, });

WHY THIS HELPS

Serve a repository’s built static assets under a URL prefix while keeping their directory structure unchanged.

REQUIREMENTS AND LIMITATIONS

  • Version: Wrangler 4.148.0 or later; cf 1.0.0-beta.13 or later with cloudflare.config.ts
  • assets.base_path / worker.assets.basePath (required): URL path prefix for served assets.
  • assets.directory: Wrangler assets directory; optional when the Cloudflare Vite plugin supplies build output.
  • Prerequisite: Wrangler 4.148.0 or later; for `cloudflare.config.ts`, cf 1.0.0-beta.13 or later.
  • The base path applies to the URL path; asset directory structure does not change.
  • Wrangler uses `assets.directory` to select the served directory. With `cloudflare.config.ts`, the build configuration supplies the assets.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card