Request.cf not working if called behind a proxy

Hello guys, I am using the request.cf values like ASN or Country in my worker script.
Sadly if I proxy the worker script into another application the request.cf results are returned with the data of the proxy (in my case AWS with AWS ASN and a location of the nearest AWS datacenter)

Is it somehow possible to pass the real client IP to maybe another worker so the request.cf shows the data of the real client ?

The proxies can naturally only take the data from the connecting client, which is the proxy in your case. If you control the whole data flow, you could have your own proxy insert custom HTTP headers with the actual client info and then use these headers either in your Worker.

yes I control the proxy and already tried to send all different IP headers with real client IP to the worker but there is no way to change the input for the “request.cf.asn” value. It still automatically use the proxy IP to process the cf object.

I even tried a worker → worker fetch with custom IP headers like x-real-ip, x-forwarded-for, cf-connecting-ip … but still it was the proxy showing in request.cf. Funny was how the IP was masked to “2a06:98c0:3600::103” but the request.cf object still had data from the proxy which means CF still process the proxy IP internally

As mentioned, Cloudflare will only go by the actual client, which is your proxy and you cannot change that. You will have to introduce your own custom headers.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.