I am exploring the implementation of Cloudflare, I found Cloudflare IP address list in the following link: IP Ranges
the documentation said that we should update the ips as stated in the list regularly. However, my application heavily depends on client’s ip for rate limit use, if the list updated but i haven’t updated in my application, my whole application will be crashed. I would like to ask if we will have api to verify an ip is coming from Cloudflare or not. Thank you in advanced.
Not really an API. You could either run whois checks against an IP and verify it belong to a Cloudflare network or regularly update the list of allowed IP addresses based on that URL. Generally you should only accept connections from these addresses.
Even though there is no guarantee of course, it would seem as if that list (typically) does not change too frequently, though. The current list appears to be in place for almost two years.
You can simply call these https endpoints to get the IP addresses in an easily parseable form:
https://www.cloudflare.com/ips-v4
https://www.cloudflare.com/ips-v6
If you must use an API and/or want more structured data then use:
https://api.cloudflare.com/client/v4/ips
(note that in that API call the ‘v4’ refers to API version 4 - it’ll bring back the IPv6 addresses too, just a coincidence that the name looks like IP v4. Also that API endpoint is unauthenticated so you don’t need any auths).
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.