Use with Cloudflare
vitobotta opened this issue · comments
Hi! I am using Cloudflare and the IP address logged is one of Cloudflare's IPs. Is it possible to log the actual IP of the client? In the rest of the app I get it from the CF-Connecting-IP header that Cloudflare sets. Thanks!
Hi @vitobotta, check out cloudflare-rails or actionpack-cloudflare, which fix request.remote_ip
globally.
Hi @ankane, thanks for suggesting the gems. I tried cloudflare-rails since the other one is no longer maintained but I couldn't get it to work. I suspect it's because I am using Rails 6.1 already (it's causing me some issues but I have to use it because of the proxy feature in ActiveStorage).
However I solved my issue at the Nginx ingress level with a similar thing. Thanks!