All domains proxied through Cloudflare have a special Cloudflare directory located at example.com/cdn-cgi/ (going to this directory will return a 404 error.) This directory is used for hosting Cloudflare apps. A special app is called ‘Trace’ and is located at https://example.com/cdn-cgi/trace/ Trace is “installed” by default (it is not listed as an installed Cloudflare app on the dashboard and cannot be uninstalled.) Calling it, for example, through a web browser will simply show some information about your connection to the given Cloudflare proxied domain. Note that Trace is only available on domains proxied through Cloudflare and is not available for domains using Cloudflare for DNS only.
The following is example output from running the Trace app at https://www.example.org/cdn-cgi/trace/.
fl=65f4 h=example.org ip=192.0.2.1 ts=1587773429.436 visit_scheme=https uag=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36 colo=CPH http=http/2 loc=DK tls=TLSv1.3 sni=plaintext warp=off
One of the fields is called ‘colo’ and is followed by a three-letter IATA airport code. This code tells the location of the Cloudflare point of presence (POP) you are connecting to. The data center locations are named according to the IATA airport codes. E.g., “colo=CPH” means you are connected to the data center Cloudflare uses in Copenhagen, Denmark.
If you happen to see an IATA code you are not familiar, with you can go to the Cloudflare Status website. This site lists the location, associated IATA code, and current status of all Cloudflare POPs throughout the world. You can also search for the location using the IATA airline and location code search (the second search field named “Search Location Codes.”)
It is not uncommon that you will connect to another POP that expected. E.g. you are located in Denmark, but connects the to the Amsterdam (AMS) POP in the Netherlands instead of the one in Copenhagen. Exactly how Cloudflare routes traffic around the world is both complex and not fully disclosed. Therefore, it is difficult to provide a detailed answer, but there are a few general possibilities:
- The nearest point of presence is overloaded or experiencing issues.
- What logically seems to be the nearest POP based on physical distance might not be the closest location when it comes to how network traffic travels. This depends on several factors such as the network routing of your ISP.
- The traffic is routed to a specific POP due to economic considerations. Bandwidth prices vary significantly between different parts of the world and between network providers. To keep costs down Cloudflare will sometimes serve domains hosted on the free and pro plans from less expensive POPs. If you want more details about global bandwidth prices, Cloudflare has published the blog post “Bandwidth Costs Around the World.”