$_SERVER['REMOTE_ADDR'] has IP of originating request

I just signed up for shared web hosting and the web host has mod_remoteip or something installed by default which is changing PHP’s value of $_SERVER[‘REMOTE_ADDR’] to the originating request and not the IP of Cloudflare’s proxy as expected. It is screwing everything up. How do I turn it off? The web server is Apache.

That’s the way most people would want it, to see the real client.

See here for how it is configured…

If you want to turn it off, assuming you have access to the configuration files, you can remove the RemoteIPHeader CF-Connecting-IP configuration file.

This is shared web hosting so I don’t have access to that. I need something I can add to my .htaccess file. Right now the only solution is to stop proxying.

I think I fixed it by going to Network → and setting Pseudo IPv4 to Overwrite Headers. That is not something I would ever ordinarily do, but it seemed to be the answer in this case.