Cloudflare traces (the cf-ray header and the __cf_bm cookie) are missing or incomplete when a request bypasses Cloudflare, when a firewall rule or bot management setting strips them, or when the origin server overwrites the header. This guide explains the most common causes and gives you a step-by-step troubleshooting path to restore full trace data.
What Are Cloudflare Traces and Why Do They Matter?
Every request that passes through Cloudflare’s network gets a unique cf-ray header, which looks like cf-ray: 7a1b2c3d4e5f6a7b-ORD. This header identifies the exact Cloudflare data center that handled the request, plus a random ID for that specific request. It is the primary way to correlate a request with Cloudflare’s logs and to diagnose issues like caching, SSL, or WAF blocks.
Incomplete traces usually mean the header is present but missing some fields, or the value is truncated. A complete cf-ray header always contains the request ID and the airport code of the data center (e.g., LAX, FRA, SIN). If you see only the ID or only the airport code, the trace is incomplete.
Traces are used for:
- Debugging cache misses and cache hits
- Identifying which Cloudflare data center served a request
- Correlating with Cloudflare’s Logpush and Analytics
- Troubleshooting WAF or bot management actions
Why Traces Go Missing: The Main Causes
There are five common reasons why you might not see a cf-ray header in your response:
- Request bypassed Cloudflare – If the origin server is accessed directly (bypassing the proxy), no Cloudflare headers are added. This happens when DNS records are set to “DNS only� (grey cloud) instead of “Proxied� (orange cloud).
- Cloudflare’s edge is not in the path – If you are testing from a server that connects directly to the origin IP, or if you are using a Cloudflare Spectrum or Workers route that does not add the header, traces will be absent.
- Firewall rules or WAF actions strip the header – Some custom firewall rules that “Block� or “Challenge� may not include the header in the response body, but it should still be in the response headers. However, if you are looking at the response body (e.g., HTML), you won’t see it because it’s a header.
- Origin server overwrites or removes the header – If your origin server (e.g., Apache, Nginx) has a rule that deletes or overwrites
cf-ray, the header will be missing or changed. This is common when you have a reverse proxy in front of your app that strips unknown headers. - You are looking at the wrong response – If you are checking a cached asset, the
cf-rayheader might not be present because the request never reached the origin. But it should still be present in the response headers from Cloudflare. If you are using a browser’s developer tools, make sure you are looking at the “Response Headers� section, not the “Request Headers�.
How to Check If a Trace Is Missing or Incomplete
The quickest way to check is to use curl or your browser’s developer tools. Here’s how:
- Using curl: Run
curl -I https://example.comand look for thecf-rayheader in the response. If it’s not there, the request didn’t go through Cloudflare or the header was stripped. - Using browser dev tools: Open the Network tab, reload the page, click on the request, and look under “Response Headers�. Search for
cf-ray. - Check the full header list: Incomplete traces might show
cf-ray: 7a1b2c3d4e5f6a7bwithout the airport code. That usually means the edge truncated it, which is rare but can happen with very old TLS connections.
If you see cf-ray in the response headers but not in the response body, that’s normal – it’s a header, not a body element.
Troubleshooting Step-by-Step
Follow these steps in order to identify and fix the issue.
Step 1: Verify the DNS record is proxied
- Log in to your Cloudflare dashboard.
- Go to DNS → Records.
- Find the record for your domain (e.g.,
example.com). - Check the cloud icon: it should be orange (Proxied). If it’s grey (DNS only), click it to change it to orange.
- Wait a few minutes for DNS propagation, then re-test.
If the record is already proxied, move to Step 2.
Step 2: Test from a different network
Sometimes your local network or ISP might have a direct route to the origin IP, bypassing Cloudflare. Use a different network, like a mobile hotspot, or use an online tool like check-host.net to test from multiple locations. If the trace appears from other networks but not from your current one, the issue is local routing – not Cloudflare.
Step 3: Check for origin server header manipulation
- Access your origin server directly (bypassing Cloudflare) by using the origin IP or a test hostname with DNS-only.
- Check the response headers – if
cf-rayis present, then Cloudflare is adding it, and the issue is on the origin side. - Look at your server configuration for any header-modifying directives. For Nginx, check for
proxy_hide_headeroradd_headerdirectives that might remove or overwritecf-ray. For Apache, checkHeader unsetorHeader setrules. - If you find a rule that strips
cf-ray, remove it or add an exception to preserve it.
Step 4: Review Cloudflare firewall rules
- In the Cloudflare dashboard, go to Security → WAF → Firewall rules.
- Look for any rule that has an action like “Block� or “Challenge� and might be interfering. The
cf-rayheader is added before firewall rules, so it should still be present even if the request is blocked. However, if you are using a custom rule that modifies headers, that could strip it. - If you have a rule that uses the “Rewrite� action, ensure it doesn’t remove the header.
Step 5: Check Cloudflare’s “Under Attack Mode� or bot management
Under Attack Mode (in Security → Settings) can sometimes interfere with how headers are presented, but it shouldn’t remove cf-ray. If you have Bot Fight Mode or Super Bot Fight Mode enabled, they might challenge requests, but the header should still be in the response. If you suspect these features, temporarily disable them and re-test.
Common Misconceptions About Cloudflare Traces
Misconception: The cf-ray header should appear in the response body. It does not – it’s a response header. You must look at the headers, not the HTML.
Misconception: If the trace is missing, Cloudflare is down. Not necessarily – the request might have bypassed Cloudflare entirely, or the origin stripped the header.
Misconception: The __cf_bm cookie is a trace. The __cf_bm cookie is a bot management cookie, not a trace. It is used to identify legitimate users, but it is not the same as cf-ray.
Alternatives to Cloudflare Traces for Debugging
If you cannot get cf-ray to work, you can use other methods to debug:
- Cloudflare Logpush – Send edge logs to your own storage and search for the request ID.
- Cloudflare Analytics – The dashboard shows request counts and performance metrics, but not per-request details.
- Origin server logs – Check your origin’s access logs for the
CF-Connecting-IPheader, which is added by Cloudflare and can help identify requests. - HTTP headers like
ServerorVia– These can indicate if a proxy is in the path.
Frequently Asked Questions
Why is the cf-ray header missing only on some pages?
If the header is missing on some pages but not others, the likely cause is that those pages are served from a different origin or through a different route. For example, if you have a subdomain that is not proxied, or if you are using a third-party service that bypasses Cloudflare, those requests won’t have the header.
Can I add cf-ray manually to my origin responses?
You can add a custom header with the same name, but it will not be the real Cloudflare trace. Cloudflare will overwrite it if the request goes through the proxy. If you add it on the origin, it might be overwritten by Cloudflare’s own header, or it might cause confusion. It’s better to rely on the real header.
Does Cloudflare add cf-ray to WebSocket connections?
Yes, Cloudflare adds the cf-ray header to WebSocket handshake responses. However, during the WebSocket connection, the header is only present in the initial handshake, not in subsequent frames. If you are debugging WebSocket traffic, check the handshake response.
How do I see the cf-ray header in my browser?
Open the browser’s developer tools (F12), go to the Network tab, reload the page, click on the request, and look under “Response Headers�. You can also use the “Headers� tab in Firefox or Chrome. If you don’t see it, click “View source� to see the raw headers.
What does the airport code in cf-ray mean?
The airport code is the IATA code for the city where the Cloudflare data center is located. For example, ORD is Chicago, LHR is London, NRT is Tokyo. This helps you know which data center served the request.
Can a missing cf-ray header indicate a security issue?
Not necessarily. It usually indicates a configuration issue, like DNS not proxied or origin stripping the header. However, if you see a request with no cf-ray and it’s coming from an unexpected IP, it might be a direct attack on your origin IP. In that case, you should hide your origin IP and ensure all traffic goes through Cloudflare.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Blockchain vs Database: When Does Distributed Trust Win?
- GTA 6 and Call of Duty on Same Console?
- MCP in Production: Security Failures Behind the Backdoor Label
- Nothing Phone 2 Waterproof? IP54 Rating Explained
- Satellite Internet Equipment & Installation Guide
- Infinix GT 20 Pro vs AI Nova 2 Ultra 5G: Which Fits?