How to Fix CF-Ray Header | Probeo
The CF-Ray header is added by Cloudflare to trace requests. This page explains why the header leaks infrastructure information and how to remove it from public responses.
The CF-Ray header is added automatically by Cloudflare to uniquely identify each request as it passes through Cloudflare infrastructure. The header confirms the use of Cloudflare and provides a request identifier that can be used to correlate traffic patterns or infrastructure topology.
What's Happening
The response includes a CF-Ray header. This header contains a unique identifier assigned by Cloudflare to the request. The identifier encodes information about the Cloudflare data center that processed the request. The header is visible in HTTP responses and confirms that the request was routed through Cloudflare.
Why It Matters
The header discloses that Cloudflare is in use and provides a traceable identifier for each request. This allows external observers to map traffic patterns, correlate requests, and infer infrastructure topology. The identifier can be used to analyze request routing behavior or identify the specific Cloudflare edge location serving traffic. This level of detail is not necessary for public responses and increases reconnaissance surface.
The Correct Change
- Remove the CF-Ray header from responses before they reach the client.
- This can be done using Cloudflare Transform Rules or Workers. Create a rule that removes the header on outbound responses.
- If Cloudflare configuration cannot be modified, configure the origin server or an intermediary proxy to strip the header.
- Retain the header in logs or internal monitoring systems if request tracing is needed for debugging.
Verification
- The CF-Ray header is absent from all HTTP responses.
- Other Cloudflare-specific headers such as CF-Cache-Status are also reviewed for removal.
- The response headers do not disclose infrastructure or request routing details.
Takeaway
- The CF-Ray header confirms the use of Cloudflare and provides a unique request identifier.
- The identifier can be used to trace and correlate requests.
- Infrastructure and routing details should not be visible in public responses.
- The header can be removed without affecting caching or routing behavior.