Cf-Ray
The HTTP Cf-Ray response header is an unofficial, Cloudflare-specific header containing a unique identifier for each request processed through the Cloudflare network.
Usage
The Cf-Ray header is added by Cloudflare to every HTTP response passing through its network. The value is a hashed identifier encoding information about the data center handling the request. Servers behind Cloudflare also receive this header as a request header, making end-to-end request tracing possible.
Adding the Cf-Ray value to origin server logs
helps match proxied requests to entries in
server-side logs. In NGINX, the value is accessible
through the $http_cf_ray variable. Enterprise
customers have access to full request data,
including ingress data center details, through
Cloudflare Logs.
Directives
ray-id
The ray-id is a hashed value uniquely
identifying the request. While each request
receives a ray ID, uniqueness is not strictly
guaranteed across all requests.
datacenter-code
The datacenter-code is a three-letter IATA
airport code identifying the Cloudflare data center
processing the request. For example, LAX
represents the Los Angeles data center and SJC
represents San Jose.
When a request is routed through Argo Smart Routing or Tiered Caching, the code reflects the data center connecting to the origin server, not the initial ingress point.
Example
The value is split into two parts separated by a
hyphen. The first part is the ray ID, a unique hash
for the request. The second part is an IATA airport
code identifying the Cloudflare data center. In
this case, SJC refers to the San Jose, California
data center.
Cf-Ray: 9ab9830f8f01234f-SJC
The same website requested from a different
geographic location routes through a different data
center. Here EWR refers to the Newark, New Jersey
data center.
Cf-Ray: 9b7d22ba0cdcde9c-EWR
When troubleshooting, the ray ID is the value to provide to Cloudflare support or to search for in log files. The data center code helps confirm which edge location handled the request.
Takeaway
The Cf-Ray response header is a Cloudflare-specific identifier attached to every proxied request. The ray ID paired with a data center code makes tracing and debugging requests across the Cloudflare network straightforward.