Available in all subroutines.
Returns the part of
haystack string starting from and including the first
needle until the end of
set req.http.X-qs = std.strstr(req.url, "?");
std.strstr 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.
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).
Compute intersection of two lists
Useful for comparing capabilities with required permissions.
Detect and reject requests from third party websites that attempt to embed your images on their pages.