react-server675fbba4
react-serverfilesdocsreact-server.wrangler.toml
docs/react-server.wrangler.tomltoml1.8 KiB699277dd
[[routes]]
pattern = "react-server.dev"
custom_domain = true

# The docs site needs the worker to run before assets on HTML routes so the
# content-negotiation middleware can serve the pre-rendered `.md` sibling
# when an agent sends `Accept: text/markdown`. Without this, Cloudflare's
# default assets-first router would short-circuit pre-rendered HTML before
# the middleware ever runs.
#
# Pattern form (vs the simpler `true`) bypasses the worker for paths that
# are unambiguously served by ASSETS: bundled binary/font assets, the
# prerendered `*.md` siblings of every page (worker has no route for
# them), and `*.txt` files like `robots.txt` / `llms.txt`. We deliberately
# do NOT exclude `.json`, `.html`, or `.xml`: the agent-discovery
# middleware serves dynamic `.json` endpoints under `/.well-known/` whose
# paths are never on disk, and the content-negotiation middleware needs
# the worker to run for HTML requests with `Accept: text/markdown`. For
# the real static `.json` assets (e.g. `/schema.json`) and `.xml`
# (`/sitemap.xml`), the worker's edge handler proxies the request to
# `env.ASSETS.fetch()` and only falls through to SSR on a genuine 404, so
# worker-first costs one cheap proxy hop and Cloudflare's `_headers` rules
# still apply (worker-proxied, not worker-generated).
#
# Any dynamic endpoint that *must* be served at an excluded extension
# (e.g. `.well-known/agent-skills/react-server/SKILL.md`) has to be
# materialized into the static-assets directory at build time so the
# ASSETS-only path can serve it. The agent-discovery middleware is then
# only the dev-mode fallback.
[assets]
run_worker_first = [
  "/*",
  "!/assets/*",
  "!/client/*",
  "!/*.svg",
  "!/*.png",
  "!/*.jpg",
  "!/*.jpeg",
  "!/*.gif",
  "!/*.webp",
  "!/*.ico",
  "!/*.css",
  "!/*.js",
  "!/*.mjs",
  "!/*.woff",
  "!/*.woff2",
  "!/*.ttf",
  "!/*.eot",
  "!/*.txt",
  "!/*.md",
]