Skip to content

Commit 636642f

Browse files
Apply suggestions from code review
Co-authored-by: Greg Brimble <[email protected]>
1 parent e194027 commit 636642f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/content/docs/workers/static-assets/routing.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,15 @@ Take the following directory structure:
219219
/folder/doesnt/exist -> 200 /index.html
220220
```
221221

222-
## Mounting assets on a path
222+
## Serving assets from a custom path
223223

224224
:::note
225225
This feature requires Wrangler v3.xx.xx or later.
226226
:::
227227

228-
You can mount assets on a path by creating a directory structure that mirrors the desired path.
229-
For example, to serve assets from `example.com/blog`, create a `blog` directory in your asset directory.
228+
Like with any other Worker, [you can configure a Worker with assets to run on a subpath of your domain](https://developers.cloudflare.com/workers/configuration/routing/routes/). Assets in such a Worker such be nested in a directory structure that mirrors the desired path.
229+
230+
For example, to serve assets from `example.com/blog/*`, create a `blog` directory in your asset directory.
230231

231232
<FileTree>
232233
- dist
@@ -240,7 +241,7 @@ For example, to serve assets from `example.com/blog`, create a `blog` directory
240241
With a Wrangler configuration file like so:
241242
<WranglerConfig>
242243
```toml
243-
name = "mounted-assets-example"
244+
name = "assets-on-a-path-example"
244245
main = "src/index.js"
245246
route = "example.com/blog/*"
246247

@@ -249,6 +250,6 @@ directory = "dist"
249250
```
250251
</WranglerConfig>
251252

252-
In this example, requests to `example.com/blog` will serve the `index.html` file, and requests to `example.com/blog/posts/post1` will serve the `post1.html` file.
253+
In this example, requests to `example.com/blog/` will serve the `index.html` file, and requests to `example.com/blog/posts/post1` will serve the `post1.html` file.
253254

254-
If you have a file outside the mounted path, it will not be served. For example, if you have a `home.html` file in the root of your asset directory, it will not be served when requesting `example.com/blog/home`.
255+
If you have a file outside the configured path, it will not be served. For example, if you have a `home.html` file in the root of your asset directory, it will not be served when requesting `example.com/blog/home`. However, if needed, these files can still be manually fetched over [the binding](https://developers.cloudflare.com/workers/static-assets/binding/#binding).

0 commit comments

Comments
 (0)