Class FrontCacheEngine

java.lang.Object
org.frontcache.FrontCacheEngine

public class FrontCacheEngine extends Object
  • Field Details

    • DEFAULT_FRONTCACHE_HOST_NAME_VALUE

      public static final String DEFAULT_FRONTCACHE_HOST_NAME_VALUE
      See Also:
    • FORWARD_PUBLIC_HOST_KEY

      public static final String FORWARD_PUBLIC_HOST_KEY
      Whether origin calls carry X-Forwarded-Host / X-Forwarded-Proto naming the public site. Off by default and deliberately so: an origin app with Spring's ForwardedHeaderFilter (or any equivalent) enabled changes every absolute URL it emits the moment these appear, which is the point of the option but is not a thing to do silently underneath a running deployment.
      See Also:
    • logger

      protected org.slf4j.Logger logger
    • debugComments

      public static boolean debugComments
  • Method Details

    • isBypassPassthroughEncoding

      public boolean isBypassPassthroughEncoding()
      Returns:
      true when a bypassed response should keep the origin's Content-Encoding
    • existingInstance

      public static FrontCacheEngine existingInstance()
      The engine if one has been built, without building one. getFrontCache() constructs the engine on first call, which is right for the request path and wrong for anything that merely observes: a Prometheus scrape must never be what starts a node. Mirrors CacheManager.existingInstance(), and for the same reason.
      Returns:
      the current engine, or null if none has been created yet
    • getFrontCache

      public static FrontCacheEngine getFrontCache()
    • getDomain

      public String getDomain()
      The site this node serves (front-cache.default-domain). Stamped on every request context and on every cache entry this node writes.
    • isForwardPublicHostToOrigin

      public boolean isForwardPublicHostToOrigin()
      Returns:
      true when origin calls should carry X-Forwarded-Host / X-Forwarded-Proto naming the public site (front-cache.origin.forward-public-host)
    • getPublicDomain

      public String getPublicDomain()
    • isNodeApiKey

      public boolean isNodeApiKey(String apiKey)
      Returns:
      true when apiKey is this node's configured management API key
    • destroy

      public static void destroy()
    • reload

      public static void reload()
    • getFcHttpClient

      public FcHttpClient getFcHttpClient()
    • getHttpClient

      public org.apache.hc.client5.http.classic.HttpClient getHttpClient()
    • processRequest

      public void processRequest(jakarta.servlet.http.HttpServletRequest servletRequest, jakarta.servlet.http.HttpServletResponse servletResponse, jakarta.servlet.FilterChain filterChain) throws Exception
      Throws:
      Exception
    • getGuardRuleEngine

      public GuardRuleEngine getGuardRuleEngine()
      Returns:
      the guard pipeline this node is running - used by the management API (get-guard-rules / reload-guard-rules) and, through it, by the console
    • processRequestInternal

      public void processRequestInternal(RequestContext context) throws Exception
      Throws:
      Exception