Class GuardAction
java.lang.Object
org.frontcache.guard.GuardAction
What a matching guard rule does with the request: reject it, redirect it, explicitly let it
through (an exemption placed above a broader rule), or challenge it - send the visitor to a
challenge provider's page under
/fc-x/<plugin>/, which is a redirect that knows which
provider it needs (see challenge(String, GuardAction)).-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic GuardActionallow()static GuardActionchallenge(String provider, GuardAction otherwise) challenge <provider> [else <reject|redirect>]: a302to the page of the plugin offering the provider - when one is started and the node can sign a pass.getBody()intgetType()static GuardActionstatic GuardActionstatic StringrequestURL(RequestContext context) Full request URL, as the client would have to type it to get back here.resolveTarget(RequestContext context) Expands ${uri} / ${query} / ${url} / ${url:enc} / ${host} in the redirect target.toString()
-
Field Details
-
DISPOSITION_REJECTED
disposition written to the failed-requests log (the is_cached column)- See Also:
-
DISPOSITION_REDIRECTED
- See Also:
-
DISPOSITION_DRY_RUN
- See Also:
-
DISPOSITION_CHALLENGED
- See Also:
-
-
Method Details
-
reject
-
redirect
-
challenge
challenge <provider> [else <reject|redirect>]: a302to the page of the plugin offering the provider - when one is started and the node can sign a pass. When either is missing, theelseaction if there is one, and otherwise the rule acts as a dry run: a node without the plugin serves every request as it would without the rule, and says so. See GuardRuleEngine for the rest of what it knows that a redirect does not (never a non-GET, never an include, never the provider's own path, never a visitor holding a pass).- Parameters:
otherwise- a reject or redirect action, or null
-
allow
-
getType
-
getStatus
public int getStatus() -
getBody
-
getTarget
- Returns:
- redirect target as configured, placeholders NOT expanded
-
getProvider
- Returns:
- the challenge provider, or null for any other action
-
getOtherwise
- Returns:
- a challenge's
elseaction, or null
-
getDisposition
- Returns:
- the disposition string for the log line, or null for ALLOW (not logged)
-
resolveTarget
Expands ${uri} / ${query} / ${url} / ${url:enc} / ${host} in the redirect target.- Parameters:
context- current request- Returns:
- target ready for the Location header
-
requestURL
Full request URL, as the client would have to type it to get back here. Built here rather than taken from RequestContext.getCurrentRequestURL(), which FrontCacheEngine only populates later and only for cacheable requests - guards run before that. Note the two independent substitutions relative to what the socket saw: the host (seepublicHost(RequestContext)) and the scheme. Behind a TLS-terminating proxy the connection reaching this process is plaintext, so the scheme comes from RequestContext.getPublicProtocol() (X-Forwarded-Proto from a trusted peer, or front-cache.public-scheme) and only then from the connection. On the example-site edges roughly one request in ten arrived over the plaintext leg, and each one produced an http:// return URL for an https-only site. -
toString
-