Skip to content

[Workers] Note the 405 for non-GET requests outside run_worker_first in SPA mode - #34475

Open
voyagi wants to merge 1 commit into
cloudflare:productionfrom
voyagi:spa-run-worker-first-405
Open

voyagi wants to merge 1 commit into
cloudflare:productionfrom
voyagi:spa-run-worker-first-405

Conversation

@voyagi

@voyagi voyagi commented Oct 20, 2026

Copy link
Copy Markdown

Summary

The "Advanced routing control" section of the Single Page Application page recommends run_worker_first with an array. In that setup, a request with a method other than GET or HEAD to a path that matches none of the patterns never reaches the Worker script: asset serving answers it with 405 Method Not Allowed.

The section says the array turns off the Sec-Fetch-Mode: navigate detection, but not that unlisted non-GET requests then stop at asset serving. The routing diagram further down reads as if a non-navigation request that matches no file falls through to the Worker script, which is not the case with an array in SPA mode, and no page mentions the 405. This PR adds one note under the example.

Why it happens, in workers-sdk at 08f22d3:

Seen on a deployed Worker with this configuration:

"assets": {
	"binding": "ASSETS",
	"not_found_handling": "single-page-application",
	"run_worker_first": ["/mcp", "/mcp/*", "/api/*"]
}
Request Response
GET /no-such-page 200, the index.html shell
POST /no-such-page 405 Method Not Allowed, empty body
PUT /no-such-page 405 Method Not Allowed, empty body
POST /mcp (listed) the Worker script's own response

Documentation checklist

@github-actions github-actions Bot added the product:workers Related to Workers product label Oct 20, 2026
@cloudflare-docs-bot

Copy link
Copy Markdown
Contributor

Review coverage

🟡 1 ownership area needs approval.

Suggested reviewers: @dinasaur404 @for-the-kidz @WalshyDev

Needs approval Eligible approvers Suggested
workers @GregBrimble, @irvinebroque, @MattieTK, @vy-ton, @WalshyDev, @cloudflare/deploy-config, @cloudflare/product-owners dinasaur404, for-the-kidz, WalshyDev
CODEOWNERS mappings for displayed areas (1)
Pattern Owners
/src/content/docs/workers/static-assets @GregBrimble, @irvinebroque, @MattieTK, @vy-ton, @WalshyDev, @cloudflare/deploy-config, @cloudflare/product-owners

@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

AI Review

✅ Reviewed 80b45ef · 0 findings · incremental

Commands
  • /review Run a review now.
  • /full-review Review the entire PR diff.
  • /disable-auto-review Stop automatic reviews.
  • /rebase Rebase against production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:workers Related to Workers product size/xs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant