Public request path
handlePublicSiteRequest() is the Cloudflare adapter’s anonymous request boundary.
- It accepts only
GETandHEADrequests without__editor__preview. - It checks the edge cache before domain resolution, database access, authentication, or rendering.
- On a cache miss, it resolves a verified hostname through the D1 control plane.
- It asks the published-site renderer for a response, marks successful cookie-free output as public-cacheable, and schedules the cache write with
waitUntil. - Preview/edit and mutation requests return
nullto a separate private/authenticated handler; they never share the public cache flow.
The concrete Astro named-cache policy also rejects /api/*, /admin, and reserved framework paths. This path check is security-critical: a queryless authenticated GET must never become publicly cacheable merely because it returns 200 without setting a cookie.
The adapter does not cache responses with Set-Cookie, errors, or non-success statuses. A concrete Worker wires caches.default, D1ControlPlane, and the renderer/service binding into this host-neutral shape.