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 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.

Serve stale on origin failure

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

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.