See section 6.2 about cache setup.
-cache-use <name>
+cache-use <name> [no-early-hints]
Usable in: QUIC Ini| TCP RqCon| RqSes| RqCnt| RsCnt| HTTP Req| Res| Aft
- | - | - | - | - | X | - | -
use a condition for both storage and delivering that's a good idea to put it
after this one.
+ When the named cache has "early-hints" enabled, lookups handled by this
+ rule may emit a 103 Early Hints response if the requested URL has known
+ "Link" hints in the cache. The optional "no-early-hints" keyword
+ suppresses 103 emission for requests handled by this rule, regardless of
+ the cache-level setting.
+
See section 6.2 about cache setup.
cannot serve the full response from the cache but the URL's "Link" hints
are still known, the cache emits a 103 Early Hints response carrying those
hints before forwarding the request to the backend, giving the client a
- head start on fetching subresources while the backend produces the body. The
- default value is off (disabled).
+ head start on fetching subresources while the backend produces the body.
+ Individual "cache-use" rules may opt out of this behavior with the
+ "no-early-hints" keyword. The default value is off (disabled).
max-age <seconds>
Define the maximum expiration duration. The expiration is set as the lowest
shctx_row_detach(shctx, entry_block);
detached = 1;
} else {
- if ((cache->flags & CACHE_CF_EARLY_HINTS) &&
+ /* p[1] holds the "no-early-hints" opt-out set by parse_cache_use(). */
+ if ((cache->flags & CACHE_CF_EARLY_HINTS) && !rule->arg.act.p[1] &&
(res->flags & (CACHE_EF_STRIPPED | CACHE_EF_COMPLETE))) {
/* The emitted hints are best-effort and may not exactly
* match the response finally served: with Vary they may
return ACT_RET_PRS_ERR;
(*orig_arg)++;
+
+ /* Stash the "no-early-hints" opt-out in p[1], read back by
+ * http_action_req_cache_use() to skip 103 emission. */
+ if (*args[*orig_arg] && strcmp(args[*orig_arg], "no-early-hints") == 0) {
+ rule->arg.act.p[1] = (void *)(uintptr_t)1;
+ (*orig_arg)++;
+ }
+
return ACT_RET_PRS_OK;
}