Class WarmRequest
java.lang.Object
org.frontcache.warmer.WarmRequest
What makes a request a warm request, and the vocabulary a warm request is answered in.
The token
The warmer sendsx-frontcache-warm: <token> to this node's own front door. The token is 256
random bits generated when this class loads. It lives only in this JVM's memory and is never
logged, returned or configured, so the only thing that can present it is this process.
resolve(HttpServletRequest, RequestContext) compares it in constant time and also requires a loopback peer, as defense in
depth. Anything else - a wrong token, the right token from a non-loopback peer, a malformed mode -
is treated as if the header were absent. It is not an error, so the header gives a prober no signal.
What a warm request changes
See docs/cache-warmer-proposal.md section 4.2. In short: the client type is the run's, notbots.conf's; the guard rules are skipped; FC_Total runs under Warm-Request;
refresh mode reads past a cached entry without removing it; a soft refresh and an async
include are resolved synchronously, so the warmer's delay paces the origin and not just the front
door; and the response carries x-frontcache-warm-result.
The headers must never reach the origin
FCUtils.isIncludedHeader drops every x-frontcache-warm* header. If that drop goes,
the token lands in the origin app's access log, and whoever reads that log can skip the guard rules
and force refreshes. WarmRequestHeaderTest asserts it.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringnormalizeClientType(String clientType) static StringnormalizeMode(String mode) static booleanresolve(jakarta.servlet.http.HttpServletRequest request, RequestContext context) Markscontextas a warm request whenrequestcarries a valid token from a loopback peer, and sets the run's client type on it.
-
Field Details
-
MODE_FILL
- See Also:
-
MODE_REFRESH
- See Also:
-
RESULT_STORED
- See Also:
-
RESULT_FRESH
- See Also:
-
RESULT_NOT_CACHEABLE
- See Also:
-
RESULT_FALLBACK
- See Also:
-
CLIENT_TYPE_RULE
WhatRequestContext.getClientTypeRule()reports for a warm request.- See Also:
-
-
Method Details
-
resolve
public static boolean resolve(jakarta.servlet.http.HttpServletRequest request, RequestContext context) Markscontextas a warm request whenrequestcarries a valid token from a loopback peer, and sets the run's client type on it. Does nothing otherwise. Must run before the client type is classified and before the guard rules - seeFrontCacheEngine.init().- Returns:
- true when the request is a warm request
-
normalizeMode
-
normalizeClientType
-