From 80b45efa70c7e1fb480af684c3de258d110944c8 Mon Sep 17 00:00:00 2001 From: voyagi <119620717+voyagi@users.noreply.github.com> Date: Tue, 20 Oct 2026 19:08:48 +0200 Subject: [PATCH] [Workers] Note the 405 for non-GET requests outside run_worker_first in SPA mode --- .../workers/static-assets/routing/single-page-application.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/content/docs/workers/static-assets/routing/single-page-application.mdx b/src/content/docs/workers/static-assets/routing/single-page-application.mdx index ffe5aa4aa46..e2152f8f721 100644 --- a/src/content/docs/workers/static-assets/routing/single-page-application.mdx +++ b/src/content/docs/workers/static-assets/routing/single-page-application.mdx @@ -91,6 +91,10 @@ export default { +:::note +When `run_worker_first` is an array, a request that matches none of its patterns goes to asset serving, and in `single-page-application` mode asset serving handles every path. Asset serving only responds to `GET` and `HEAD` requests. A request with any other method, such as a `POST` from a form or an API client, to a path outside your patterns receives a `405 Method Not Allowed` response and does not invoke your Worker script. Add every path your Worker script handles to `run_worker_first`, whatever its method. +::: + You can also use `run_worker_first` to inject data into your SPA shell before it reaches the browser. For a full example using HTMLRewriter to prefetch API data and embed it in the HTML stream, refer to [SPA shell with bootstrap data](/workers/examples/spa-shell/). ## Local Development