req.restarts

INTEGER, read-only.

Available inall subroutines.

Counts the number of times the VCL has been restarted. For more information, check out the restart statement.

Try it out

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

Apply feature flags from an origin API

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

Detect leaked passwords

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.