Class WarmRequest

java.lang.Object
org.frontcache.warmer.WarmRequest

public final class WarmRequest extends Object
What makes a request a warm request, and the vocabulary a warm request is answered in.

The token

The warmer sends x-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, not bots.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 Details

  • Method Details

    • resolve

      public static boolean resolve(jakarta.servlet.http.HttpServletRequest request, RequestContext context)
      Marks context as a warm request when request carries 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 - see FrontCacheEngine.init().
      Returns:
      true when the request is a warm request
    • normalizeMode

      public static String normalizeMode(String mode)
      Returns:
      fill | refresh, or null for anything else
    • normalizeClientType

      public static String normalizeClientType(String clientType)
      Returns:
      bot | guest, or null for anything else