Best way to multiple sites and services under one domain?

Hi there. I am looking into porting existing microsites and microservices from our own custom platform to Render. And I am wondering what would be the best way to achieve the following setup on Render:

example.com -> a root web service that serves some CMS-backed content. 
example.com/path-a -> web service A
example.com/path-b -> web service B
example.com/service/path-c -> web service C

I understand that keeping this setup will have some other tradeoffs (such as the PR preview URLs may not work properly). And we are looking into a new URL scheme as well. For now, it would be great to find a way to migrate existing services without much modifications, and later plan to migrate them one-by-one to a better fitting setup.

Thank you all in advance!

1 Like

Would using rewrite rules cover your use case? It may be possible to use Preview Environments to preserve connectivity between services for PR previews.

Hello Ralph, thank you for the reply!

Using Rewrite/Redirect is a good direction. I seemed to be able to achieve the thing I describe with it with minimum efforts! I created an empty GitHub repository to deploy as a static site, and the Rewrite/Redirect was then available for configure. However this method still has one short-fall for my setup – the site behind the root domain must be a static site.

The site I would like to use for my root domain is a Next.js instance deployed as Node Server. If I create a separated, empty Static Site instance solely for Rewrite/Redirect, I will not be able to configure a Rewrite to the root path.

I think the best way to go now for me is to refactor my root site – deploy it only as a static site to use Rewrite/Redirect as much as I want.

Could it be an idea to make the “Rewrite/Redirect” feature available for a Web Service instance as well. But I am not sure what could be the consequence or if this is even possible or planned by Render.

Thanks again for the guide! This is really a nice platform to work with :smiley:

Hi @ten, thanks for the kind words! It’s clever to use an empty static site with rewrites. I may be misunderstanding your use case, but I should point out that rewrite rules are applied in the order they are listed. So you could potentially do something like:

2 Likes