Feasible to reverse proxy using qualifier in URL?

(Christopher Kampmeier) #1

I’ve seen many references to configuring reverse proxies to map “/” to a backend Discourse site, but I haven’t seen examples where something other than slash is mapped. For example, I would like to establish a reverse proxy to map multiple Discourse sites by qualifying the URL after the host/domain name.

ProxyPreserveHost On
ProxyRequests Off
ProxyPass /meta/ http://<IP address 1>/
ProxyPassReverse /meta/ http://<IP address 1>/
ProxyPass /foo/ http://<IP address 2>/
ProxyPassReverse /foo/ http://<IP address 2>/

When this approach is taken, the main page is loaded, but all references back to the site lack the “/meta/” qualifier and result in 404s.

Is it feasible to prefix Discourse sites addresses in this manner?

I’d prefer not to use different FQDNs to distinguish between sites.

1 Like

(Matt Palmer) #2

Set the relative_url_root option in your discourse.conf to the path prefix for each instance (eg relative_url_root = /meta). This should instruct Rails to generate paths with the specified prefix prepended. You’ll need to restart the app in order for the setting to take effect.


(Kane York) #3

Here’s the guide on subfolder:


(Christopher Kampmeier) #4

Excellent. Worked great! Per the discussion posts, I had to also set the long polling base url to specify the subfolder in the form of /subfolder/, but once that was done uploads and some other features started working properly.


(system) automatically bumped #5

(Sam Saffron) closed #6