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

**URL:** https://meta.discourse.org/t/whats-the-proper-way-to-set-up-discourse-behind-a-reverse-proxy/30262
**Category:** Self-hosting
**Created:** [Juin 20, 2015, 11:15 UTC](https://meta.discourse.org/t/whats-the-proper-way-to-set-up-discourse-behind-a-reverse-proxy/30262 "2015-06-20T23:15:07Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![seanthegeek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/seanthegeek/32/116327_2.png) [@seanthegeek](https://meta.discourse.org/u/seanthegeek)
#### Post date: [Juin 20, 2015, 11:15 UTC](https://meta.discourse.org/t/whats-the-proper-way-to-set-up-discourse-behind-a-reverse-proxy/30262/1 "2015-06-20T23:15:07Z")

</div>

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`?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [Juin 20, 2015, 11:17 UTC](https://meta.discourse.org/t/whats-the-proper-way-to-set-up-discourse-behind-a-reverse-proxy/30262/2 "2015-06-20T23:17:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![hayzem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hayzem/32/97875_2.png) [@hayzem](https://meta.discourse.org/u/hayzem)
#### Post date: [Mai 31, 2018, 8:53 UTC](https://meta.discourse.org/t/whats-the-proper-way-to-set-up-discourse-behind-a-reverse-proxy/30262/3 "2018-05-31T08:53:22Z")

</div>

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

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [Mai 31, 2018, 10:15 UTC](https://meta.discourse.org/t/whats-the-proper-way-to-set-up-discourse-behind-a-reverse-proxy/30262/4 "2018-05-31T10:15:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [Août 17, 2023, 8:51 UTC](https://meta.discourse.org/t/whats-the-proper-way-to-set-up-discourse-behind-a-reverse-proxy/30262/5 "2023-08-17T20:51:14Z")

</div>


