Subfolder (domain.com/docs) or subdomain (docs.domain.com) for external CMS?

Mounting an external CMS under a subfolder is better for SEO, and one way to do it is to use Cloudflare Worker to dispatch / rewrite URL.

But it seems overkill to me — has anyone tried it in different ways? Just put your own Nginx instance somewhere?

For that matter, I added a feature request here,

but it’s not showing up on the list, and am wondering if it’s just me.

Hi there,

Sure, there is nothing stopping you from doing this. You could host your doc as static site, or a separate CMS server. Your main site can rewrite any request made /docs to the domain of your docs service.

Regards,

Keith
Render Support, UTC+10 :australia:

1 Like

Thanks Keith!

Yes that’s doable in theory but it’s a high friction work implementation-wise.

If I were using DigitalOcean, I would just put Nginx in front of everything and let it handle rewrite, but with Render I would expect something out-of-the-box.

For the sake of separation of concerns, I don’t want to slip the code into the main app that handles URL rewrites toward another domain. It’s a tight coupling of the reverse-proxy concern with the app platform (it also depends on if the server is event-driven or not)

I’ve seen another forum post about setting up an Nginx instance, and it was not recommended.

What’s your recommendation exactly?

Hi there,

The link to the previous discussion was when they were only running a single service and wanted to put Nginx in front of that. That isn’t necessary, and I wouldn’t recommend doing it. It just adds unnecessary complexity to your service for no added benefit.

In your use case, it would be fine as you need it. You can do it in one of two ways.

  1. Run Nginx, CMS/docs and main service as separate services. For the CMS and main service, you would use the private service type to prevent them from being accessed directly. You would then run Nginx as the web service to which you add your custom domain. This would need to use docker, which you configure to proxy the requests using the local network, with the internal service address to the private services (using a blueprint would be a good idea here).
  2. You could also bundle all 3 services (CMS, main service, Nginx) into a single custom docker image and deploy that to a single service on Render. Nginx would listen on the port that is exposed to our proxy and would either proxy requests to localhosts:<port> of your backing services or use a Unix socket connection. This would be an option if your services are not resource intensive.

One last possibility could be if your docs could be deployed as a static site. You could use a rewrite to write requests made to /docs to the root of your static site and all other requests to your main service, which would just run on a onrender.com domain. Your custom would be added to the static site. You’d probably want to make a small change to your main site so it redirects all requests to the onrender.com domain to your custom domain to prevent direct access to it.

Regards,

Keith
Render Support, UTC+10 :australia:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.