Available in all subroutines.

Takes a string (which represents an integer) as an argument and returns its value. Behaves as if calling std.strtol with a base of 10.


if (std.atoi(req.http.X-Decimal) == 42) {
set req.http.X-TheAnswer = "Found";

Try it out

std.atoi 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 recipesfor more inspiration.

Click RUN on a sample below to provision a Fastly service, execute the code on Fastly, and see how the function behaves.

Time-limited URL tokens

Make URLs expire after a configurable period.

User contributed notes

We welcome comments that add use cases, ideas, tips, and caveats. All comments will be moderated before publication. To post support questions, visit our support center and we'll find you the help you need.