Requests to none Cloudflare sites with path /cdn-cgi/ fail

A worker which requests content from another site can't access paths starting with /cdn-cgi/ because Cloudflare handles these. Is there any documentation for this problem and why does Cloudflare even handle these requests? Example Worker
export default {
async fetch(request, env, ctx) {
return fetch("https://myip.wtf/cdn-cgi/trace");
},
};
export default {
async fetch(request, env, ctx) {
return fetch("https://myip.wtf/cdn-cgi/trace");
},
};
Expected output
No such *** page!
No such *** page!
Actual output
fl=537f256
h=myip.wtf
ip=2a06:98c0:3600::103
ts=1746039523.85
visit_scheme=https
uag=
colo=*****
sliver=none
http=http/1.1
loc=*****
tls=off
sni=off
warp=off
gateway=off
rbi=off
kex=none
fl=537f256
h=myip.wtf
ip=2a06:98c0:3600::103
ts=1746039523.85
visit_scheme=https
uag=
colo=*****
sliver=none
http=http/1.1
loc=*****
tls=off
sni=off
warp=off
gateway=off
rbi=off
kex=none
7 Replies
Chaika
Chaika17h ago
Cloudflare uses them for a ton of products and features https://developers.cloudflare.com/fundamentals/reference/cdn-cgi-endpoint/
Cloudflare Docs
/cdn-cgi/ endpoint
When you add a domain to Cloudflare, Cloudflare adds a /cdn-cgi/ endpoint (www.example.com/cdn-cgi/) to that domain.
Chaika
Chaika17h ago
it's the main way custom assets hosted on CF for features like rocket loader/etc are loaded on your site (if not injected directly) and also used by a ton of features
sn00py1310
sn00py1310OP17h ago
But the website in question is not using Cloudflare and from my browser I geht the other response
Chaika
Chaika17h ago
Workers subrequests even to non-cf sites go out through the normal cdn layer
sn00py1310
sn00py1310OP17h ago
So there is no way to request a resource at a /cdn-cgi/ path? And where is this documented?
Chaika
Chaika16h ago
the cdn-cgi path is documented above if you mean the limitation of not being able to fetch specific paths, not sure if it is, it's simply a quirk of fetch implementation that basically outgoing fetch requests are treated as if myip.wtf is a cloudflare website/is proxied
sn00py1310
sn00py1310OP16h ago
Ok thanks for the help

Did you find this page helpful?