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.

User contributed notes

BETA

Do you see an error in this page? Do you have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact Fastly support)