We've been making changes to how we organize and display our docs. Our work isn't done but we'd love your feedback.

std.str2ip()

Converts the string representation of an IP address (IPv4 or IPv6) into an IP type. If conversion fails, the fallback will be returned. The string must be a numeric IP address representation in the standard format such as 192.0.2.2 and 2001:db8::1. This function does not support looking up an IP address by name.

We recommend using a fallback IP address that's meaningful for your particular Fastly service.

Format

IP
std.str2ip(STRING addr, STRING fallback)

Examples

1
2
3
if (std.str2ip(req.http.Fastly-Client-IP, "192.0.2.2") ~ my_acl) {
  ...
}