Eviepayne
(vladtheimplier)
May 17, 2026, 4:27am
1
I recently migrated my forum to a much more performant host, and I am working towards high availability.
in the reverse proxy I added the Forward Proto and For headers but the nginx configuration on the discourse only respected the Proto.
I had to add under server:
set_real_ip_from loadbalancerip;
real_ip_header X-Forwarded-For;
Is there a discourse envvar to add these?
or possibly a argument to add to app.yml?
I believe this is what you’re looking for:
@pfaffman edited this heavily 2022.02.24. Blame me if it’s broken.
If you want to run other websites on the same machine as Discourse, you need to set up an extra NGINX or HAProxy proxy in front of the Docker container.
NOTE: This is for advanced admins
This guide assumes you already have Discourse working - if you don’t, it may be hard to tell whether or not the configuration is working.
You cannot use ./discourse-setup to set up Discourse if another server is using port 80 or 443. You will…
Eviepayne
(vladtheimplier)
May 17, 2026, 5:44am
3
No this guide explains how to setup an nginx socket that’s shared between the container and host.
I’m trying to find a declarative way to include:
set_real_ip_from loadbalancerip;
real_ip_header X-Forwarded-For;
In the nginx configuration in containers after rebuild.
You’re trying to add this to the container’s internal nginx? I believe that’s unnecessary because it’s added by default:
Eviepayne
(vladtheimplier)
May 17, 2026, 5:56am
5
This line is needed for that to work.
Without it all the requests are still the loadbalancer IP.
I know because my discourse was down for 429 errors.
In case it’s not clear this is my infra:
user > haproxy > discourse
Discourse of course includes an nginx rproxy
I included the forwarding headers in haproxy but the discourse internal nginx was not respecting forwarded for. I had to add the 2 lines in my OP and restart the container for it to work.