a month ago
Hello, Im finding an way to automate domain provisioning for clients in my new SAAS.
The agent on railway.com responded to me this way ->
"Your setup:
You have *.app.kilivi-dev.cz pointing to your Railway service
Your app routes based on subdomain (e.g., client1.app.kilivi-dev.cz, client2.app.kilivi-dev.cz)What the client does: If they own restaurace-u-draka.cz, they need to create a CNAME record at their DNS provider:
Subdomain: www (or @ for apex)
Type: CNAME
Value: app.kilivi-dev.cz
So www.restaurace-u-draka.cz → points to app.kilivi-dev.cz → which is your wildcard *.app.kilivi-dev.cz
Then in your app: When someone visits www.restaurace-u-draka.cz, the request hits your service. Your app needs to:
Read the Host header
Identify it's www.restaurace-u-draka.cz (not your domain)
Route to the correct client's data based on that domainImportant: You'll also need to add restaurace-u-draka.cz as a service domain in Railway so the SSL certificate covers it. But you can do this programmatically if Railway adds API support, or manually for each client.
Does your Payload CMS app already handle multi-tenant routing by domain?"
And I would like to know if its true and I could go by this way and add this approach to the docs for the clients.
Pinned Solution
a month ago
If I understand this correctly, you're trying to route users to different domains based off of the client header.
You'd need to set up some kind of function in Railway that intercepts all requests then routes them based on the header value.
Also, you can add domains via Railway's API by using the customDomainCreate mutation call.
2 Replies
a month ago
If I understand this correctly, you're trying to route users to different domains based off of the client header.
You'd need to set up some kind of function in Railway that intercepts all requests then routes them based on the header value.
Also, you can add domains via Railway's API by using the customDomainCreate mutation call.
a month ago
Please do not create duplicate threads.
Status changed to Solved 0x5b62656e5d • 4 days ago