When deploying Discourse in a 1Panel container with a reverse proxy and using Cloudflare CDN for the domain, how can I resolve the issue where all traffic appears to originate from Cloudflare’s servers instead of the users’ actual browser IP addresses?
You want to use the Cloudflare template in your app.yml.
Tried it, but it didn’t work
. The failure might be because I deployed it using a 1panel container and used a reverse proxy?
Can you edit the nginx configuration file directly? If so, make the changes suggested here. And now after reloading the nginx service it should be working. Hope this helps!
Curious on the reasons for running 2 reverse proxies? One at the hosting company and CloudFlare. Is there a technical reason?
I deployed Discourse using containers via the 1Panel server management panel (open-source) for convenient server management.
The 1Panel architecture is: User -> Cloudflare -> 1Panel Nginx -> Discourse container.
My understanding is that even if I modify the app.yml configuration in Discourse, 1Panel’s Nginx still sits between Cloudflare and Discourse.
So it is a technical constraint introduced by 1panel.
Are you running multiple servers or only Discourse on the VPS? If you are only running discourse you probably do not need 1panel. Unless, there is a technical reason you need 1 panel.
My discourse is native on a vps behind cloudflare. This setup works.
Besides Discourse, there’s also OpenClaw ![]()
Almost certainly.
Is the IP you’re seeing teh 1panel container IP?
When viewing users as an administrator, the last used IP address displayed is a Cloudflare IP address.
Have you implemented this?
This is the fix for Apache to use the end user ip instead of the cloudflare ip address.
Thanks, I’m using nginx. I’ve looked up some tutorials that involve configuring the host’s nginx for reverse proxying. I’ll give it a try when I have some time.
Did you install the cloudflare template as suggested? If not, then why are you asking for help here?
Cloudflare template? I’ve already modified the yml configuration file and enabled the Cloudflare template. However, I’m deploying Discourse via 1Panel containers (1Panel architecture: User → Cloudflare → 1Panel Nginx → Discourse container). Just changing the yml file isn’t enough; you also need to modify the reverse proxy Nginx configuration file inside 1Panel. I don’t have time right now, so I haven’t gotten around to making those changes yet.
It sounds like you need to modify 1Panel’s instance of nginx to utilize its real_ip functionality for user requests. Cloudflare sends along this information with the CF-Connecting-IP header, and you can utilize that header to tell nginx what to do with itself.
It would likely be worthwhile to build some script-based automation to regularly download cloudflare’s proxy address lists (ipv4, ipv6) to keep your nginx real_ip ranges updated.
If you don’t have access to your 1Panel nginx.conf file, you’re probably out of luck. Nginx’s real_ip + cloudflare’s CF-Connecting-IP header is how this problem is intended to be solved if you’re managing your own reverse proxy in front of self-hosted Discourse.