fastly_info.state

STRING, read-only.

Available in all subroutines.

State of the request, with optional additional suffixes describing particulars of the request. Possible values are:

States:

ValueDescription
NONENo state assigned by Varnish yet.
HIT-We are serving previously-cached content.
HITPASS-This request has been previously marked as pass (uncacheable) in vcl_fetch.
HIT-STALE-We are transitioning into a Hit state but the object's TTL has expired.
HIT-SYNTH-We are serving a synthetic response.
MISS-We are serving uncached content.
PASS-We are serving uncached content that we do not intend to cache for future requests.

Error states:

ValueDescription
BG-ERROR-[state]An error occurred during a background fetch in [state] (possible options: PASS, RECV, ERROR).
ERRORTransitioned into vcl_error with a 4xx or 5xx response code.
ERROR-LOSTHDRReturned a 503 because Varnish ran out of memory during header processing.

Suffixes:

ValueDescription
-CLUSTERThe response will be served internally from another node within the POP.
-REFRESHWe got back a 304, and served the cached If-Modified-Since content.
-WAITThis request had to wait for a highly-contended object.

Try it out

fastly_info.state is used in the following solution recipes, which show real world use cases. Click RUN to provision a Fastly service, execute the code on Fastly, and see how the function behaves.

Comprehensive logging

Fastly offers a myriad of different variables that you can log. See and test a large collection here.

User contributed notes

We welcome comments that add use cases, ideas, tips, and caveats. All comments will be moderated before publication. To post support questions, visit our support center and we'll find you the help you need.