Available inall subroutines.
True if the string
s begins with the string
begins_with. An empty string is
not considered a prefix.
set req.http.X-ps = std.prefixof("greenhouse", "green");
Try it out
std.prefixof 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.
Authenticate JSON Web Tokens at the edge
Decode the popular JWT format to verify user session tokens before forwarding trusted authentication data to your origin.