For a request that should use an already stored response, HTTP defines Cache-Control: only-if-cached.

A client can send it through an HTTP caching proxy:

curl --proxy http://127.0.0.1:3128 \
  --header 'Cache-Control: only-if-cached' \
  --include http://www.example.org/report

A cache honoring this directive should return a stored response consistent with the request's other constraints, or 504 Gateway Timeout when it cannot satisfy the request. Here, a 504 can express cache policy rather than a failed TCP connection to the proxy.

The directive does not automatically authorize stale content. Freshness, validation requirements and matching Vary fields still matter. The no-cache request directive can instead require successful origin validation before reuse.

This is also different from configuring a cache's offline validation mode. only-if-cached is carried on the individual request and expresses what the client is willing to receive.

Use a cache that supports the behavior. An ignored request directive is not a firewall, so strict prevention of upstream traffic needs an independently enforced network or server policy.

An ordinary HTTPS CONNECT proxy does not see the encrypted HTTP headers or retain page objects from that tunnel. The example deliberately uses a plain HTTP resource the cache can process.

Ũhoro ũhĩtĩte