How do I enable custom domains for my users?

Hello Colleagues!

I have an app hosted on Render - that allows users to create their own webpages based on unique URLs.

For example:

–//---------------------------/website/12345 - URL webpage with custom Data that belongs to User1
----//--------ending with /website/22233 - URL webpage with custom Data that belongs to User2

And so on…

My question:
What’s the best way to allow users - to assign Custom Domains - to their webpages on my APP?

So this URL:
https://myapp.com/website/12345

Will be accessed from their custom domain.

As far as I understand (correct me if I’m wrong):

  1. A user will have to use CNAME and point to my APP IP ADDRESS.
    Does Render use floating IP Address - or is it static - so my customers can use it?

  2. I’ll have to create a middleware for my express server pointing requested host (custom domain) to the right URL on my app

Thanks in advance!
Vasily

Hi @Vas,

Welcome to the Render community! There are a few possible solutions for providing your users with custom domains depending on how you set things up:

  1. You can have your users create a CNAME record that targets myapp.render.com (it wouldn’t be the IP address of your service but the domain name itself). Then, in your application, you can inspect the Host header to see which domain corresponds.

  2. If the sites you are providing your users are static sites, you can set up a static site in front of your web service and have your users create a CNAME record that targets mystaticsite.render.com and create a rewrite rule for every request to your backend service. Then inspect the X-Forwarded-Host header to find the domain.

Hi Tyler!
Thanks a lot for guiding me.
I’ll explore and test the options you mentioned.

Best Regards,
Vas