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, which show real world use cases. Click RUN 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.

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.