Subfolder Support

On the Business and Enterprise plans we support a so-called subfolder setup. Instead of running on its own hostname, Discourse will appear in a subdirectory of another host, for instance /forum or /community.

This makes the experience much more seamless, especially when you style your Discourse instance to closely match the look and feel of the rest of your website.

However, this setup is more complex and takes some effort to configure. The configuration on our side and on your side need to happen at the same time since putting your forum into subfolder mode will render it unaccessible by any other means.

For the configuration on our side, we need to know the following:

  • the hostname you will be using;
  • the subdirectory name you will be using;
  • the IP address(es) of the server(s) running the remainder of your website (or if you’re using a service like Cloudfront or Cloudflare, we need to know that).

On your side you need to set up a reverse proxy configuration that applies to the subdirectory and anything ‘within’ it.

You need to take care of two things there:

  • You need to forward the actual host name to the forum – after all, the forum needs to use that in order to recognise the traffic;
  • You need to address the forum by its discoursehosting.net hostname, because you cannot address it by the external hostname – that would create an endless loop since it points to the server containing the reverse proxy.

An example for nginx would be:

location /SUBDIRECTORY {
    proxy_pass https://YOURFORUM.discoursehosting.net/;
    proxy_set_header Host "WWW.YOURDOMAIN.COM";
    proxy_http_version 1.1;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

You need to replace the capitalized text by your specific configuration.

The configuration on our side is done outside of the control panel, so you need to contact our support for it.