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, "?");
Try it out
std.strstr is used in the following solution recipes. Recipes apply VCL to real-world use cases and can be deployed as-is, or adapted for your own service. See the full list of recipes 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.