beresp.stale_while_revalidate

RTIME, can be read and set, but not unset.

Available infetch

Same as beresp.stale_if_error except controls the maximum stale age for stale while revalidate functionality.

Note that if an object's TTL has expired and it is eligible to be served stale and to be served stale while revalidating, stale while revalidate takes precedence. By default the value of beresp.stale_while_revalidate will be parsed from the stale-while-revalidate value in the Surrogate-Control or Cache-Control headers received from the backend.

Try it out

beresp.stale_while_revalidate is used in the following code examples. Examples apply VCL to real-world use cases and can be deployed as they are, or adapted for your own service. See the full list of code examples for more inspiration.

Click RUN on a sample below to provision a Fastly service, execute the code on Fastly, and see how the function behaves.

Serve stale on origin failure

Deal with all potential scenarios for using stale content to satisfy requests when origin is unhealthy or misbehaving.