diff --git a/src/content/docs/workers/configuration/multipart-upload-metadata.mdx b/src/content/docs/workers/configuration/multipart-upload-metadata.mdx
index 307bf3cb0b9c62..b95292f489e923 100644
--- a/src/content/docs/workers/configuration/multipart-upload-metadata.mdx
+++ b/src/content/docs/workers/configuration/multipart-upload-metadata.mdx
@@ -1,7 +1,6 @@
---
pcx_content_type: concept
title: Multipart upload metadata
-
---
import { Type, MetaInfo } from "~/components";
@@ -12,15 +11,15 @@ If you're using the [Workers Script Upload API](/api/resources/workers/subresour
```json
{
- "main_module": "main.js",
- "bindings": [
- {
- "type": "plain_text",
- "name": "MESSAGE",
- "text": "Hello, world!"
- }
- ],
- "compatibility_date": "2021-09-14"
+ "main_module": "main.js",
+ "bindings": [
+ {
+ "type": "plain_text",
+ "name": "MESSAGE",
+ "text": "Hello, world!"
+ }
+ ],
+ "compatibility_date": "2021-09-14"
}
```
@@ -33,41 +32,38 @@ The following attributes are configurable at the top-level.
At a minimum, the `main_module` key is required to upload a Worker.
:::
+- `main_module`
+ - The part name that contains the module entry point of the Worker that will be executed. For example, `main.js`.
-* `main_module`
-
- * The part name that contains the module entry point of the Worker that will be executed. For example, `main.js`.
-
-* `assets`
+- `assets`
- * [Asset](/workers/static-assets/) configuration for a Worker.
- * `config`
- * [html_handling](/workers/static-assets/routing/advanced/html-handling/) determines the redirects and rewrites of requests for HTML content.
- * [not_found_handling](/workers/static-assets/routing/) determines the response when a request does not match a static asset.
- * `jwt` field provides a token authorizing assets to be attached to a Worker.
+ - [Asset](/workers/static-assets/) configuration for a Worker.
+ - `config`
+ - [html_handling](/workers/static-assets/routing/advanced/html-handling/) determines the redirects and rewrites of requests for HTML content.
+ - [not_found_handling](/workers/static-assets/#routing-behavior) determines the response when a request does not match a static asset.
+ - `jwt` field provides a token authorizing assets to be attached to a Worker.
-* `keep_assets`
+- `keep_assets`
- * Specifies whether assets should be retained from a previously uploaded Worker version; used in lieu of providing a completion token.
+ - Specifies whether assets should be retained from a previously uploaded Worker version; used in lieu of providing a completion token.
-* `bindings` array\[object] optional
+- `bindings` array\[object] optional
- * [Bindings](#bindings) to expose in the Worker.
+ - [Bindings](#bindings) to expose in the Worker.
-* `placement`
+- `placement`
- * [Smart placement](/workers/configuration/smart-placement/) object for the Worker.
- * `mode` field only supports `smart` for automatic placement.
+ - [Smart placement](/workers/configuration/smart-placement/) object for the Worker.
+ - `mode` field only supports `smart` for automatic placement.
-* `compatibility_date`
+- `compatibility_date`
- * [Compatibility Date](/workers/configuration/compatibility-dates/#setting-compatibility-date) indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. Highly recommended to set a `compatibility_date`, otherwise if on upload via the API, it defaults to the oldest compatibility date before any flags took effect (2021-11-02).
+ - [Compatibility Date](/workers/configuration/compatibility-dates/#setting-compatibility-date) indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. Highly recommended to set a `compatibility_date`, otherwise if on upload via the API, it defaults to the oldest compatibility date before any flags took effect (2021-11-02).
-* `compatibility_flags` array\[string] optional
-
- * [Compatibility Flags](/workers/configuration/compatibility-flags/#setting-compatibility-flags) that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`.
+- `compatibility_flags` array\[string] optional
+ - [Compatibility Flags](/workers/configuration/compatibility-flags/#setting-compatibility-flags) that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a `compatibility_date`.
## Additional attributes: [Workers Script Upload API](/api/resources/workers/subresources/scripts/methods/update/)
@@ -78,25 +74,21 @@ For [immediately deployed uploads](/workers/configuration/versions-and-deploymen
These attributes are **not available** for version uploads.
:::
+- `migrations` array\[object] optional
+ - [Durable Objects migrations](/durable-objects/reference/durable-objects-migrations/) to apply.
-* `migrations` array\[object] optional
-
- * [Durable Objects migrations](/durable-objects/reference/durable-objects-migrations/) to apply.
-
-* `logpush`
+- `logpush`
- * Whether [Logpush](/cloudflare-for-platforms/cloudflare-for-saas/hostname-analytics/#logpush) is turned on for the Worker.
+ - Whether [Logpush](/cloudflare-for-platforms/cloudflare-for-saas/hostname-analytics/#logpush) is turned on for the Worker.
-* `tail_consumers` array\[object] optional
+- `tail_consumers` array\[object] optional
- * [Tail Workers](/workers/observability/logs/tail-workers/) that will consume logs from the attached Worker.
-
-* `tags` array\[string] optional
-
- * List of strings to use as tags for this Worker.
+ - [Tail Workers](/workers/observability/logs/tail-workers/) that will consume logs from the attached Worker.
+- `tags` array\[string] optional
+ - List of strings to use as tags for this Worker.
## Additional attributes: [Version Upload API](/api/resources/workers/subresources/scripts/subresources/versions/methods/create/)
@@ -107,15 +99,11 @@ For [version uploads](/workers/configuration/versions-and-deployments/#upload-a-
These attributes are **not available** for immediately deployed uploads.
:::
+- `annotations`
-
-* `annotations`
-
- * Annotations object specific to the Worker version.
- * `workers/message` specifies a custom message for the version.
- * `workers/tag` specifies a custom identifier for the version.
-
-
+ - Annotations object specific to the Worker version.
+ - `workers/message` specifies a custom message for the version.
+ - `workers/tag` specifies a custom identifier for the version.
## Bindings
@@ -123,88 +111,88 @@ Workers can interact with resources on the Cloudflare Developer Platform using [
```json
{
- "bindings": [
- {
- "type": "ai",
- "name": ""
- },
- {
- "type": "analytics_engine",
- "name": "",
- "dataset": ""
- },
- {
- "type": "assets",
- "name": ""
- },
- {
- "type": "browser_rendering",
- "name": ""
- },
- {
- "type": "d1",
- "name": "",
- "id": ""
- },
- {
- "type": "durable_object_namespace",
- "name": "",
- "class_name": ""
- },
- {
- "type": "hyperdrive",
- "name": "",
- "id": ""
- },
- {
- "type": "kv_namespace",
- "name": "",
- "namespace_id": ""
- },
- {
- "type": "mtls_certificate",
- "name": "",
- "certificate_id": ""
- },
- {
- "type": "plain_text",
- "name": "",
- "text": ""
- },
- {
- "type": "queue",
- "name": "",
- "queue_name": ""
- },
- {
- "type": "r2_bucket",
- "name": "",
- "bucket_name": ""
- },
- {
- "type": "secret_text",
- "name": "",
- "text": ""
- },
- {
- "type": "service",
- "name": "",
- "service": "",
- "environment": "production"
- },
- {
- "type": "tail_consumer",
- "service": ""
- },
- {
- "type": "vectorize",
- "name": "",
- "index_name": ""
- },
- {
- "type": "version_metadata",
- "name": ""
- }
- ]
+ "bindings": [
+ {
+ "type": "ai",
+ "name": ""
+ },
+ {
+ "type": "analytics_engine",
+ "name": "",
+ "dataset": ""
+ },
+ {
+ "type": "assets",
+ "name": ""
+ },
+ {
+ "type": "browser_rendering",
+ "name": ""
+ },
+ {
+ "type": "d1",
+ "name": "",
+ "id": ""
+ },
+ {
+ "type": "durable_object_namespace",
+ "name": "",
+ "class_name": ""
+ },
+ {
+ "type": "hyperdrive",
+ "name": "",
+ "id": ""
+ },
+ {
+ "type": "kv_namespace",
+ "name": "",
+ "namespace_id": ""
+ },
+ {
+ "type": "mtls_certificate",
+ "name": "",
+ "certificate_id": ""
+ },
+ {
+ "type": "plain_text",
+ "name": "",
+ "text": ""
+ },
+ {
+ "type": "queue",
+ "name": "",
+ "queue_name": ""
+ },
+ {
+ "type": "r2_bucket",
+ "name": "",
+ "bucket_name": ""
+ },
+ {
+ "type": "secret_text",
+ "name": "",
+ "text": ""
+ },
+ {
+ "type": "service",
+ "name": "",
+ "service": "",
+ "environment": "production"
+ },
+ {
+ "type": "tail_consumer",
+ "service": ""
+ },
+ {
+ "type": "vectorize",
+ "name": "",
+ "index_name": ""
+ },
+ {
+ "type": "version_metadata",
+ "name": ""
+ }
+ ]
}
```
diff --git a/src/content/docs/workers/frameworks/framework-guides/react.mdx b/src/content/docs/workers/frameworks/framework-guides/react.mdx
index 75f4698e42fb5c..66b8404e766cf8 100644
--- a/src/content/docs/workers/frameworks/framework-guides/react.mdx
+++ b/src/content/docs/workers/frameworks/framework-guides/react.mdx
@@ -25,7 +25,7 @@ import {
/>
---
-**Or just deploy** - create a full-stack app using React, Hono API And Vite, with CI/CD and previews all set up for you.
+**Or just deploy** - create a full-stack app using React, Hono API and Vite, with CI/CD and previews all set up for you.
[](https://dash.cloudflare.com/?to=/:account/workers-and-pages/create/deploy-to-workers&repository=https://github.com/cloudflare/templates/tree/staging/vite-react-template)
diff --git a/src/content/docs/workers/static-assets/binding.mdx b/src/content/docs/workers/static-assets/binding.mdx
index f37472854e5cda..8cace3addee917 100644
--- a/src/content/docs/workers/static-assets/binding.mdx
+++ b/src/content/docs/workers/static-assets/binding.mdx
@@ -115,7 +115,7 @@ In the example above, assets would be available through `env.ASSETS`.
Your dynamic code can make new, or forward incoming requests to your project's static assets using the assets binding. For example, `env.ASSETS.fetch(request)`, `env.ASSETS.fetch(new URL('https://assets.local/my-file'))` or `env.ASSETS.fetch('https://assets.local/my-file')`.
-Take the following example that configures a Worker script to return a response under all requests headed for `/api/`. Otherwise, the Worker script will pass the incoming request through to the asset binding. In this case, because a Worker script is only invoked when the requested route has not matched any static assets, this will always evaluate [`not_found_handling`](/workers/static-assets/routing/) behavior.
+Take the following example that configures a Worker script to return a response under all requests headed for `/api/`. Otherwise, the Worker script will pass the incoming request through to the asset binding. In this case, because a Worker script is only invoked when the requested route has not matched any static assets, this will always evaluate [`not_found_handling`](/workers/static-assets/#routing-behavior) behavior.
@@ -178,4 +178,4 @@ Enabling Smart Placement with `run_worker_first=false` (or not specifying it) le
Use Smart Placement with `run_worker_first=false` (or not specifying it) when prioritizing fast asset delivery.
-This will not impact the [default routing behavior](/workers/static-assets/routing/).
+This will not impact the [default routing behavior](/workers/static-assets/#routing-behavior).
diff --git a/src/content/docs/workers/static-assets/index.mdx b/src/content/docs/workers/static-assets/index.mdx
index d575c32233d67b..3293be5d20c771 100644
--- a/src/content/docs/workers/static-assets/index.mdx
+++ b/src/content/docs/workers/static-assets/index.mdx
@@ -83,13 +83,12 @@ export default {
### Routing behavior
-By default, if a requested URL matches a file in the static assets directory, that file will always be served — without running Worker code. If no matching asset is found and a Worker is configured, the request will be processed by the Worker instead.
+By default, if a requested URL matches a file in the static assets directory, that file will be served — without invoking Worker code. If no matching asset is found and a Worker script is present, the request will be processed by the Worker. The Worker can return a response or choose to defer again to static assets by using the [assets binding](/workers/static-assets/binding/) (e.g. `env.ASSETS.fetch(request)`). If no Worker script is present, a `404 Not Found` response is returned.
-- If no Worker is set up, the [`not_found_handling`](/workers/static-assets/routing/) setting in your Wrangler configuration determines what happens next. By default, a `404 Not Found` response is returned.
+The default behavior for requests which don't match a static asset can be changed by setting the [`not_found_handling` option under `assets`](/workers/wrangler/configuration/#assets) in your Wrangler configuration file:
-- If a Worker is configured and a request does not match a static asset, the Worker will handle the request. The Worker can choose to pass the request to the asset binding (through `env.ASSETS.fetch()`), following the `not_found_handling` rules.
-
-You can configure and override this default routing behaviour. For example, if you have a Single Page Application and want to serve `index.html` for all unmatched routes, you can set `not_found_handling = "single-page-application"`:
+- [`not_found_handling = "single-page-application"`](/workers/static-assets/routing/single-page-application/): Sets your application to return a `200 OK` response with `index.html` for requests which don't match a static asset. Use this if you have a Single Page Application.
+- [`not_found_handling = "404-page"`](/workers/static-assets/routing/static-site-generation/#custom-404-pages): Sets your application to return a `404 Not Found` response with the nearest `404.html` for requests which don't match a static asset.
diff --git a/src/content/docs/workers/static-assets/routing/advanced/html-handling.mdx b/src/content/docs/workers/static-assets/routing/advanced/html-handling.mdx
index b058cd572d237e..0589efc47a7257 100644
--- a/src/content/docs/workers/static-assets/routing/advanced/html-handling.mdx
+++ b/src/content/docs/workers/static-assets/routing/advanced/html-handling.mdx
@@ -23,7 +23,7 @@ Take the following directory structure:
## Automatic trailing slashes (default)
-This will usually give you the desired behavior automatically: individual files (e.g. `foo.html`) will be served _without_ a trailing flash and folder index files (e.g. `foo/index.html`) will be served _with_ a trailing slash.
+This will usually give you the desired behavior automatically: individual files (e.g. `foo.html`) will be served _without_ a trailing slash and folder index files (e.g. `foo/index.html`) will be served _with_ a trailing slash.
diff --git a/src/content/docs/workers/static-assets/routing/static-site-generation.mdx b/src/content/docs/workers/static-assets/routing/static-site-generation.mdx
index 2ba31e2cdfe257..cdb947eebe7d58 100644
--- a/src/content/docs/workers/static-assets/routing/static-site-generation.mdx
+++ b/src/content/docs/workers/static-assets/routing/static-site-generation.mdx
@@ -8,7 +8,7 @@ sidebar:
import { WranglerConfig, Render } from "~/components";
-Static Site Generation (SSG) applications are web applications which are predominantely built or "prerendered" ahead-of-time. They are often built with a framework such as [Gatsby](/workers/frameworks/framework-guides/gatsby/) or [Docusaurus](/workers/frameworks/framework-guides/docusaurus/). The build process of these frameworks will produce a many HTML files and accompanying client-side resources (e.g. JavaScript bundles, CSS stylesheets, images, fonts, etc.). Data is either static, fetched and compiled into the HTML at build-time, or fetched by the client from an API with client-side requests.
+Static Site Generation (SSG) applications are web applications which are predominantely built or "prerendered" ahead-of-time. They are often built with a framework such as [Gatsby](/workers/frameworks/framework-guides/gatsby/) or [Docusaurus](/workers/frameworks/framework-guides/docusaurus/). The build process of these frameworks will produce many HTML files and accompanying client-side resources (e.g. JavaScript bundles, CSS stylesheets, images, fonts, etc.). Data is either static, fetched and compiled into the HTML at build-time, or fetched by the client from an API with client-side requests.
Often, an SSG framework will allow you to create a custom 404 page.
@@ -32,7 +32,7 @@ In order to deploy a Static Site Generation application to Workers, you must con
-`assets.html_handling` defaults to `auto-trailing-slash` and this will usually give you the desired behavior automatically: individual files (e.g. `foo.html`) will be served _without_ a trailing flash and folder index files (e.g. `foo/index.html`) will be served _with_ a trailing slash. Alternatively, you can force trailing slashes (`force-trailing-slash`) or drop trailing slashes (`drop-trailing-slash`) on requests for HTML pages.
+`assets.html_handling` defaults to `auto-trailing-slash` and this will usually give you the desired behavior automatically: individual files (e.g. `foo.html`) will be served _without_ a trailing slash and folder index files (e.g. `foo/index.html`) will be served _with_ a trailing slash. Alternatively, you can force trailing slashes (`force-trailing-slash`) or drop trailing slashes (`drop-trailing-slash`) on requests for HTML pages.
### Custom 404 pages
diff --git a/src/content/docs/workers/wrangler/configuration.mdx b/src/content/docs/workers/wrangler/configuration.mdx
index d463330c3cfdae..77ef7c7c256b3a 100644
--- a/src/content/docs/workers/wrangler/configuration.mdx
+++ b/src/content/docs/workers/wrangler/configuration.mdx
@@ -694,8 +694,8 @@ To bind Images to your Worker, assign an array of the below object to the `image
```jsonc
{
"images": {
- "binding": "IMAGES", // i.e. available in your Worker on env.IMAGES
- },
+ "binding": "IMAGES" // i.e. available in your Worker on env.IMAGES
+ }
}
```
@@ -1037,7 +1037,7 @@ The following options are available under the `assets` key.
- `not_found_handling`:
- - Determines the handling of requests that do not map to an asset. Learn more about the various options in [assets routing](/workers/static-assets/routing/).
+ - Determines the handling of requests that do not map to an asset. Learn more about the various options for [routing behavior](/workers/static-assets/#routing-behavior).
Example:
diff --git a/src/content/partials/workers/workers-assets-routing-summary.mdx b/src/content/partials/workers/workers-assets-routing-summary.mdx
index d30823f56410a7..1ad15be8bd9d31 100644
--- a/src/content/partials/workers/workers-assets-routing-summary.mdx
+++ b/src/content/partials/workers/workers-assets-routing-summary.mdx
@@ -2,6 +2,6 @@
{}
---
-By default, Cloudflare first tries to match a request path against a static asset path, which is based on the file structure of the uploaded asset directory. This is either the directory specified by `assets.directory` in your Wrangler config or, in the case of the [Cloudflare Vite plugin](/workers/vite-plugin/), the output directory of the client build. Failing that, we invoke a Worker if one is present. If there is no Worker, or the Worker then uses the asset binding, Cloudflare will fallback to the behaviour set by [`not_found_handling`](/workers/static-assets/routing/).
+By default, Cloudflare first tries to match a request path against a static asset path, which is based on the file structure of the uploaded asset directory. This is either the directory specified by `assets.directory` in your Wrangler config or, in the case of the [Cloudflare Vite plugin](/workers/vite-plugin/), the output directory of the client build. Failing that, we invoke a Worker if one is present. If there is no Worker, or the Worker then uses the asset binding, Cloudflare will fallback to the behaviour set by [`not_found_handling`](/workers/static-assets/#routing-behavior).
Refer to the [routing documentation](/workers/static-assets/routing/) for more information about how routing works with static assets, and how to customize this behavior.