Correlation ID

Are cf-request-id and/or x-request-id headers documented, or guaranteed for proxied requests?

As part of creating Correlation ID in our system, I’ve noticed proxied requests (orange cloud) include the two headers, which values look like a trace-id compliant string (16 byte hexadecimal sequence):

  • cf-request-id
  • x-request-id

I could not find documentation for either. Are any of them reliable enough to serve as my trace-id seed?

I do see the cf-request-id, but don’t see the other in my requests. As far as I know this ID will stay for the long term, so I would be inclined to suggest you to use it. Can’t guarantee anything, obviously… someone from the team has to confirm.

1 Like

I have received a response from CS:

The cf-request-id header is a new Cloudflare header that will eventually replace the Cloudflare rayID header. This should be a unique value in the future and should be included in all proxied requests.
With regards to x-request-id this is not a Cloudflare header included in proxied requests.

Update regarding the string format:

As we grow, we continue to see the amount of HTTP requests we process increase. In order to ensure that each HTTP request remains unique, we need to enlarge the field size, from 16 (cf-ray-id) to 32 characters (cf-request-id).

1 Like

Yeah, the other I couldn’t find… I didn’t recall it and I was correct. Somewhere in your stack something adds it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.