Available inall subroutines.

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


if (std.atof(req.http.X-String) > 21.82) {
set req.http.X-TheAnswer = "Found";

Try it out

std.atof 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.

Geofence / block access to content by region

Group countries to cache content by custom regions or reject requests from some regions entirely.

Comprehensive logging

Fastly offers a myriad of different variables that you can log. See and test a large collection here.