cloudflare / cloudflare/workerd

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

Open
#6,849 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
8.7k
Forks
739
Avg merge
2d 20h
Merged PRs (30d)
174

Description

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

Contributor guide

Open the contributing guide

Research direction

Start with the Cache API entry points named in the issue—caches.default, Cache.match(), and Cache.put()—then read RFC 10008 §2.7 and the body-aware key reference in Node's undici. Done means QUERY responses can be cached with keys incorporating the request body and Content-Type, with the stated size cap and bypass fallback covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
43/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.