Skip to content

Support caching HTTP QUERY (RFC 10008) responses, keyed on the request body #6849

Description

@jeswr

RFC 10008 defines QUERY — a safe, idempotent, cacheable HTTP method carrying a request body whose content defines the query. Per §2.7, a QUERY response is cacheable and the cache key MUST incorporate the request content (not just method + URL + Vary).

Today the Cache API (caches.default, Cache.match() / Cache.put()) is GET-oriented and does not cache QUERY responses keyed on the request body, so a Worker cannot serve a QUERY result from cache — which is the main advantage of QUERY over POST-as-read.

Ask: support caching QUERY responses with a key derived from the request body (+ Content-Type) per §2.7 — e.g. allow QUERY in Cache.match() / Cache.put() with the request body folded into the key (buffering it before key computation, with a size cap and a cache-bypass fallback for unbuffered bodies). The managed edge cache is the natural follow-on; the Cache API contract is the piece workerd owns.

Context: RFC 10008 was co-authored by a Cloudflare engineer (James M. Snell), so there is likely natural interest here. A reference implementation of a body-aware QUERY cache key exists in Node's undici (nodejs/undici), and server-side support is emerging (Eclipse Jetty, Apache Tomcat).


Part of a broader RFC 10008 adoption effort: https://github.com/jeswr/http-query-adoption

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions