req.restarts

INTEGER, read-only.

Available in all subroutines.

Counts the number of times the VCL has been restarted.

Try it out

req.restarts is used in the following solution recipes. Recipes apply VCL to real-world use cases and can be deployed as-is, or adapted for your own service. See the full list of recipes 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.

Preflighting for flags

Park request, make a different request first, use the response to annotate the real origin request (or make decisions about how to route it).

Threat intelligence preflight

Detect requests that contain submitted passwords and use a service to determine whether the password has leaked before allowing the request to proceed to origin (data from haveibeenpwned).

Google Cloud Storage origin (public)

Use a public GCS bucket as a backend for your Fastly service.