Available in all subroutines.
Counts the number of times the VCL has been restarted.
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.
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.