Class PluginEndpoints

java.lang.Object
org.frontcache.plugin.host.PluginEndpoints

public final class PluginEndpoints extends Object
E2 Serve: the paths plugins own, /fc-x/<id>/, and the challenge providers they offer.

The prefix is reserved

FrontCacheEngine.processRequest hands every request under "/fc-x/" here, after the guard rules and before the cache - in server and filter mode alike. Such a request is never cached, never forwarded to the origin and never a cache key; every answer carries Cache-Control: no-store. A path no started plugin owns answers 404, which is what a node without the plugin answers. A site whose origin serves pages under /fc-x/ loses them to this - the release note says so.

A plugin that fails is a plugin that is absent - for its own path only

Each plugin has a concurrency cap ("front-cache.plugins.%s.max-concurrent", default 32): over it, 503 with Retry-After, without reaching the plugin. Its response is buffered (CorePluginResponse), so one that throws - or writes more than the buffer - answers 503 and nothing it began reaches the visitor; a body over "front-cache.plugins.%s.max-body" (default 64 KiB) answers 413. Every answer is a request-log line whose is-cached column is plugin:<id> (plugin:none for a 404).
  • Field Details

  • Method Details

    • isReserved

      public static boolean isReserved(String uri)
      Returns:
      whether uri is under the reserved prefix (/fc-x itself included)
    • isRunning

      public static boolean isRunning()
      Whether the plugins have been started (and not stopped) - before that no provider is known yet.
    • challenge

      public static PluginEndpoints.Challenge challenge(String provider)
      The plugin offering provider - when one is started with an endpoint and the node can sign a pass. Null otherwise: a challenge no one can pass must not be issued.
    • serve

      public static void serve(RequestContext context, Predicate<String> redirectAllowed)
      Answers a request under "/fc-x/". Never throws: whatever goes wrong is the plugin's path answering 503.
      Parameters:
      redirectAllowed - what a plugin's redirect target is checked against - the guard's own rule