disable cf-connecting-ip
# workers-help
g
Hi, I am using cloudflare worker as a proxy to multiple REST API's. However I do not want that the REST API's get the users real IP from the
cf-connecting-ip
header. I enabled
Remove visitor IP headers
in the transform rules but the REST API servers still got the
cf-connecting-ip
header in the request. Then I made a new modify request header rule like attached images shows but the REST API servers still got the
cf-connecting-ip
header. What am I doing wrong?

https://cdn.discordapp.com/attachments/1107986464396025926/1107986464530239559/image.png

hello? any help?
bruh, can someone help me here?
a
If you remove the
X-Real-IP
header from the incoming request, the Workers subrequest won't have the user's IP in
CF-Connecting-IP
.
Copy code
js

const requestHeaders = new Headers(request.headers)

requestHeaders.delete('X-Real-IP')

return fetch(request, {
  headers: requestHeaders
})
g
🤔 i did this
but didnt worked
a
Did you remove the X-Real-IP header?
g
then i actually set the cf-connecting-ip header with trash data
ye
but at the destiny server was still the correct ip
so my header even got overwritten by cloudflare
e
Could you share the code thats sending the request?
its almost this
e
and in which part are you removing the headers?
when i paste here https://download-proxy.zhaofengying.com/ a https://webhook.site/ url webhook.site still get the original user ip

https://cdn.discordapp.com/attachments/1107986464396025926/1110607951598735510/image.png

i noticed tho
when i manually add a cf-connecting-ip header to the await fetch(downloadUrlString, ...
the cf-connecting-ip header is the first header / at the top here
but overwritten with the original ip
and idea? lol
solved it
it was cached 💀
thx to yall
5 Views