The short version

  • Cache-Control: only-if-cached is an instruction, not a question: answer from storage, or return 504 and stay quiet.
  • That 504 is minted at the edge without a single packet touching the origin — so it proves a local miss, never an upstream failure.

At 3:14 a.m., a pager fires on the origin team's rotation because a probe returned 504. The origin logs show nothing. Not a slow request, not a failed request — nothing at all. The origin did not stumble; it was never invited. Somewhere in front of it, a cache had been told to answer only from what it already held, found nothing eligible, and returned Gateway Timeout to describe its own emptiness. The alert, reading nothing but the status code, blamed the wrong building.

This is the most expensive species of monitoring bug: not a missing signal, but a signal that confidently names the wrong suspect. The ambiguity exists because 504 carries a general meaning and a cache-specific use. RFC 9110 defines Gateway Timeout as a gateway or proxy that did not receive a timely response from an upstream server it needed to access. RFC 9111 then hands a cache honoring only-if-cached exactly two exits: return a stored response consistent with the request's other constraints, or return 504. In that second branch, the client itself requested that no upstream retrieval happen. The cache complied, and the status code reports on its own inventory.

What RFC 9110 and RFC 9111 each mean by 504

The directive quietly rewrites the experiment. It does not ask, “Can the origin answer?” It asks, “Can this cache satisfy the request from something it is already allowed to reuse?” Reading that answer as an end-to-end availability verdict fuses two control paths that were never the same path. One measures upstream health; the other measures local eligibility and forwarding policy.

Picture the probe that started it: an operator wants to know whether a configuration snapshot is resident at an edge, so the probe sends a GET with Cache-Control: only-if-cached. The edge holds no stored response satisfying the request and returns 504. An alerting rule sees a status code, labels it an origin timeout, and pages the origin team. The cache did precisely what it was told — it did not forward, and the origin received no request at all.

Stored is not the same as eligible

Mere presence of bytes is not enough. RFC 9111 still requires the target URI and method to match, the nominated Vary fields to match, validation requirements to be satisfied, and the response to be fresh, successfully validated, or explicitly permitted to be served stale. A cache can hold a response for a URI and still have no eligible answer. The 504 can therefore mean “nothing suitable here under these constraints” — which is not even “nothing stored here.”

Which cache answered? The status code will not say

A request can cross a browser cache, an enterprise proxy, a CDN and a gateway before anyone writes a log line, and the 504 names none of them. Operators need the responding cache identity, the directive observed at that hop, the candidate lookup result, and whether forwarding was suppressed. Without those facts, a status-only dashboard assigns responsibility by convention and calls it evidence.

The operational stakes are not abstract. Origin incidents and cache-residency failures have different owners, different rollback actions and different customer consequences. Paging the origin team for a deliberately local miss burns the first ten minutes of an incident on the wrong hypothesis. Worse is the sequel: run an ordinary probe beside the cache-only probe, watch one return 200 and the other 504, and someone will call the origin “intermittent” — when the two probes simply asked different questions.

The cache-only decision receipt

Use a cache-only decision receipt. This is an editorial control construct, not an IETF-defined protocol object. Bind the request target and method, every Cache-Control request directive, cache identity and lookup key, the candidate responses considered, the Vary comparison, freshness or stale authority, the validation requirement, the selected response or miss, the forwarding decision, and any upstream-attempt trace. Then classify the outcome into one of three buckets: cache eligibility, forwarding policy, or upstream timing.

The receipt makes negative evidence useful. “No upstream attempt” does not prove the origin was healthy; it proves this observation cannot establish that the origin failed. Origin reachability needs its own probe, sent without the cache-only constraint.

The bottom line

One status code can remain perfectly standards-conformant while supporting two incompatible stories. The request and the execution trace decide which story is justified. Instrument the trace — or keep paging the wrong team.

Sources