#Placement inside worker

6 messages · Page 1 of 1 (latest)

terse knoll
#

Is it possible to get the placement inside of a worker (for analytics reasons)? It seems like colo is the closest DC to the user, not the actual placement (when using smart placement).

sick raft
#

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.

terse knoll
#

oh thats helpful ok

neon crypt
sick raft
#

I did not know about that. That is a better solution in this case, at least if it doesn't get removed 😅

terse knoll
#

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