What's the proper way to set up Discourse behind a reverse proxy?

I’d like to set up ningix on my docker host to be a reverse proxy for my Discourse web-only container, so that I can host sites other than Discourse on the same host. I know I need to modify the expose section, but what about DISCOURSE_HOSTNAME? Will Discourse except connections from 127.0.0.1 from the reverse proxy if DISCOURSE_HOSTNAME is set to something like forum.example.com?

if you expose a port/ip, all traffic for that port will be handled. The only issue you need to resolve is IP forwarding. So you need to customize NGINX to allow for the forwarded IP addresses so it does not look like all traffic is coming from 1 IP, there is a post here on meta covering that.

1 Like

@sam I couldn’t find the post. Can you post it here?

I believe he is referring to this one
https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247/21