Tell HN: Cloudflare silently injects its analytics when you switch nameservers
- Infrastructure
- Privacy
- Security
- Web Performance
The post is a warning from a site owner who moved nameservers to Cloudflare so an R2 bucket could sit behind a custom subdomain, then discovered Cloudflare had inserted a Web Analytics script into a static site that previously served no JavaScript at all. The key clarification is that this is not Cloudflare somehow changing traffic while acting as a pure DNS host. It happens when records are proxied through Cloudflare, shown as the orange cloud in the dashboard, which means Cloudflare terminates TLS, serves traffic from its edge, and can rewrite the HTML before it reaches the browser. Several people confirmed they saw the same behavior, including on sites where they believed analytics was off, and one linked Cloudflare's own post announcing that Web Analytics had been enabled by default. The thing people found most aggravating was not the technical mechanism but the product design. Proxied records are easy to enable unintentionally, they are the default in many setups, and disabling the injected script was buried enough that some users had to first enable analytics just to reach the control to turn it off. A related surprise was that other Cloudflare features such as Email Address Obfuscation also inject JavaScript. The bottom line from the comments is simple: once traffic is proxied through Cloudflare, you should assume it may be modified unless you explicitly disable the relevant features and verify the output yourself.
If you use Cloudflare, audit every record to see whether it is proxied or DNS-only, then inspect the actual HTML your users receive. Treat Cloudflare as an active reverse proxy that can rewrite traffic, not as a passive DNS provider, and review all default-on features before putting a domain behind it.
-
news.ycombinator.com
- Discuss on HN