X-Forwarded-For and CF-Connecting-IP not working "properly" in end server

So i am basically using my site with cloudflare on it as a proxy to middle man to a auth server for an extra layer of proteciton.

It goes Me → My Sever → Auth Server

I send a post request on my machine, which goes to the php file on my server, which then takes the information, does some magic and sends it to the auth server then routed back through to the original machine.

The issue i am facing is, when i am doing this, on the auth server it is using the IP from my website instead of the clients IP. I am sort of new to cloudflare but i have messed with some rules to try to get it working properly but i just cannot, i even tried to manually send the headers in my php file to the auth server and still no luck unfortunalty.

The auth server uses CF-Connecting-IP to get the ip addess of the client when logged in, if there is no header for that it resorts to using X-Forwarded-For, and if that does not exist it just uses remote_addr.

The only thing i can really think of that is happening is that when i make the post request on my server to send to the auth server, cloudflare adds cf and x header with the servers IP?

Im just stuck, i could really use some help.

Sorry you are dealing with that, CF-Connecting-IP should give you the right IP address. I would recommend trying the methods we provide if you haven’t already.

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