Getting WARP/Gateway Egress IP Programatically

When using WARP+ or Gateway, your egress IP changes - endpoints on Cloudflare see your “real” WAN IP address, and endpoints elsewhere on the internet see a Cloudflare IP as your client address per https://developers.cloudflare.com/warp-client/known-issues-and-faq#why-is-my-public-ip-address-sometimes-visible

I’d like to understand whether there is a Cloudflare provided endpoint I can call to get what that egress VIP “would” be?

e.g. similar to https://www.cloudflare.com/cdn-cgi/trace - so I can show both addresses to a user in a browser extension I am working on.

(I am aware of What’s My IP and similar sites, but those aren’t reliable and don’t meet my privacy needs)

Do you mean WARP’s IP address? The IP that’s seen by non-cf hosted websites?

there’s a lot, each countries/cities have their own single/multiple ip blocks for WARP (as far as I know)

Correct - the one that the site you’re visiting is seeing would be best, since I can refresh the extension’s state on tab loading or completion events.

IIRC, WARP egress IPs are based on the colo (“edge PoP”) closest to you [from a networking PoV] - e.g. I consistently get an IP that geolocates to San Jose (SJC), regardless of where the site is hosted.

That IP might change over time but I’d expect it to be the same no matter the site I’m visiting in a given moment of time. Put another way, I would expect any off-Cloudflare site I visit in the next 5 minutes to see the same 8.45.41.237 address. It’s that address I want to be able to retrieve.

I don’t think CF provides lists of IPs per countries/regions, as it can change in the future (expansion, etc).

You can refer to the current IP blocks at AS13335 Cloudflare, Inc. - bgp.he.net

Then use geoip database providers (maxmind, etc) to fetch the countries

I’m not looking for a per-region list - I’m looking for the current egress VIP that WARP uses to connect [as a client] to a given internet endpoint.

I don’t understand the terminology you are using (current egress VIP)? very important person?

do you mean like this?

VIP (Virtual IP) is a common networking term, but I admit it can be odd if you haven’t seen it before!

And no, that doesn’t meet my requirement of a Cloudflare-provided endpoint - ipinfo.io falls into the below category:

(I am aware of What’s My IP and similar sites, but those aren’t reliable and don’t meet my privacy needs)

Sadly nothing I can help. Cloudflare doesn’t provide any endpoint that returns the WARP public ip AFAIK.

The only endpoint that they provide is the cdn-cgi/trace page.

Or why don’t you build your own? There are this things called serverless now.

There is not. And because of smart routing it’s possible that address could be different depending on the origin’s location. You could certainly build a tool to determine this based on a unique query url (or similar strategy).

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.