# 从不同服务器反向代理到 Discourse 时出现过多重重定向

**URL:** https://meta.discourse.org/t/too-many-redirects-when-reverse-proxying-to-discourse-from-a-different-server/101590
**Category:** Self-hosting
**Created:** [2018年十一月8日 05:27 UTC](https://meta.discourse.org/t/too-many-redirects-when-reverse-proxying-to-discourse-from-a-different-server/101590 "2018-11-08T05:27:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jaesung2061](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jaesung2061/32/123771_2.png) [@jaesung2061](https://meta.discourse.org/u/jaesung2061)
#### Post date: [2018年十一月8日 05:27 UTC](https://meta.discourse.org/t/too-many-redirects-when-reverse-proxying-to-discourse-from-a-different-server/101590/1 "2018-11-08T05:27:46Z")

</div>

I set up Discourse on the domain [discuss.example.com](http://discuss.example.com) and i’m trying to make it so that [realsite.com/discuss](http://realsite.com/discuss) (different machine) proxies the request to [discuss.example.com/discuss](http://discuss.example.com/discuss). I’ve already set up the subdirectory according to [Serve Discourse from a subfolder (path prefix) instead of a subdomain](https://meta.discourse.org/t/subfolder-support-with-docker/30507) and it’s working fine. e.g [discuss.example.com/discuss](http://discuss.example.com/discuss) works.

However I’m struggling to set up the proxy on Nginx on the server that is proxying.

```
location ~/discuss(.*)$ {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    proxy_pass https://discuss.example.com;
    # I also tried this among others
    # proxy_pass https://discuss.example.com$1;
}

```

It’s hitting the Discourse server according to `top` but i’m getting a `ERR_TOO_MANY_REDIRECTS` error attempting to go to [realsite.com/discuss](http://realsite.com/discuss). I’m 90% sure it’s not an Nginx problem because the request is coming in from the Discourse side, but it’s causes too many redirects. I’m guessing it has something to do with the subdirectory redirect on Discourse. E.g. I go to [discuss.example.com](http://discuss.example.com) and it redirects to [discuss.example.com/discuss](http://discuss.example.com/discuss).

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2021年八月22日 16:14 UTC](https://meta.discourse.org/t/too-many-redirects-when-reverse-proxying-to-discourse-from-a-different-server/101590/2 "2021-08-22T16:14:27Z")

</div>


