Cf-ray and workers: different request and response values for preview, testing, and production


I haven’t seen more in-depth Cf-Ray info in the worker context so I’m posting some examples of not immediately obvious or documented behavior:

Cf-Ray headers in different execution environments and contexts have different kinds of values:

When accessing through event.request.headers.get(“Cf-Ray”):

  • Preview: 42976698df8c0ef1-EWR
  • Testing: null
  • Production: 4297768238d721ec - notice the lack of data-center iata

When accessing through response.headers.get(“Cf-Ray”):

  • Preview: 42977c5afa039dcd-ORD (request based ray was 42977c5a1c6c4716-EWR)
  • Testing: 429782467a93718b-ORD (request based ray was null)
  • Production: 42978a17be20214a-EWR (request based ray was 42978a17be20214a)

Why isn’t the Cf-Ray’s full, documented format used in the request side headers?

tldr: Cf-Ray at the request side in production omits the data-center iata for some reason.


If what you want is to find the datacenter that’s handling the request, has the IATA code:


Is that new? Useful! Do you know if the behavior with respect to the difference in request, response and the various environments is different now?


good to know I also didnt know about it
I guess it make sense, they see each request separately, so 1 request go to cf, and 1 subrequest go into the origin to get the content, so each of this request get different id.