client.ip

IP, read-only.

Available in all subroutines.

The IP address of the client making the HTTP request. This variable will be the same as remote.ip except when overridden with the header Fastly-Client-IP.

This header is protected and should only be set by the web server terminating HTTPS.

Try it out

client.ip is used in the following solution recipes, which show real world use cases. Click RUN to provision a Fastly service, execute the code on Fastly, and see how the function behaves.

Client public IP API at the edge

Quickly fetch the user's public IP from an API endpoint on your own domain, with no origin.

Custom condition for triggering WAF

The web application firewall runs only on traffic to your origin, but you can further refine when it should be invoked.

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.