sincecutoff.com
← all changes

Workers Assets supports `assets.base_path`

Introduced 2026-10-06 · score 0.98

HOW TO USE IT

To serve the configured assets directory under a public prefix, set `assets.base_path` to that root-relative path in Wrangler configuration. For authored `200` asset rewrites, include the prefix in both the source and destination paths.

{"assets":{"directory":"./public","base_path":"/docs"}}

WHY THIS HELPS

Serve a Workers Assets directory under a public URL prefix while keeping its on-disk layout unchanged.

REQUIREMENTS AND LIMITATIONS

  • Version: 4.148.0
  • assets.directory: Folder of static assets to serve.
  • assets.base_path: Public path prefix; the 4.148.0 release example uses `/docs`.
  • URL-shaped values are rejected.
  • Omitting the option preserves existing root-path behavior.
  • Authored `_headers` and `_redirects` rules continue to match full public paths.
  • Requests passed to a user Worker, request-facing headers, and redirects retain the public path.
  • Docs conflict: The current Wrangler configuration docs describe `assets.directory` but do not list `assets.base_path`; they may reflect a newer or different documentation state than Wrangler 4.148.0. No conflicting behavior was used.

FIRST-PARTY EVIDENCE

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

Report a problem with this card