How to get my Durable Object's location?

and is it possible to change the location?
8 Replies
zegevlier
zegevlier8mo ago
Get your location can be done by fetching https://cloudflare.com/cdn-cgi/trace, it includes a colo field which will tell you where the DO is located As for moving, that's not possible. You'll need to create a new object (potentially with a location hint) to have that
samual
samual8mo ago
oh, this api dosn't accept any param like DO id, so it means all the DOs created by my workers are in the same location?
kian
kian8mo ago
It's not an API - it shows you request information, which in this case would show the colo where your DO is.
samual
samual8mo ago
ok I see, that means if the DO creation process was trigger by my request, then it will created in that colo location right?
kian
kian8mo ago
No - you need to request that endpoint inside of your Durable Object
samual
samual8mo ago
oh I see, I will try it Hi kian, I got the location result, but where do they mean? colo=SEA colo=SJC colo=LAX
kian
kian8mo ago
They're IATA codes for airports. Cloudflare's colos are identified by the nearest airport. LAX is Los Angeles International, for example.
samual
samual8mo ago
I find it, thank you very much sir!