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.