#Placement inside worker
6 messages · Page 1 of 1 (latest)
It's a bit hacky, but you can always send a request to https://cloudflare.com/cdn-cgi/trace, parse out the colo= field and use that. That request should be really quick, since it's all inside of CF's network.
I am not aware of any other way to get the colo your worker is running in from inside your code.
oh thats helpful ok
smart placement also sets the cf-placement header on the request which you can check: https://developers.cloudflare.com/workers/configuration/smart-placement/#cf-placement-header
I did not know about that. That is a better solution in this case, at least if it doesn't get removed 😅
As far as I can tell that header isnt set on the request object that actually comes in to the worker, though it is helpful on the response