3 years ago
Hi! We'd love to use Railway but custom domains are holding us back so far. We use Cloudflare for custom domains (https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/) and I haven't been able to figure out how to make it work with Railway. Host header rewrites are only available in the Cloudflare Enterprise Plan it seems which is too expensive for us atm.
We could use CF workers to rewrite the request but that would mean that every request goes through a worker and I can't judge at the moment whether that adds too much overhead and/or cost.
Did anyone else try this so far? Would love to know whether we are the first or what other solutions were found so far.
I reached out via email already but thought maybe the community has some insights 🤗
Cheers
20 Replies
3 years ago
so I'm not familiar with this cloudflare for saas thing, but how would it's nameservers differ from regular name servers? or do they?
I'm not sure what you mean. Every customer uses their existing dns provider, Cloudflare gives us just a CNAME address and acmechallenge that the customers enter into their provider pretty much like Railway does it. If for example a custom domain is roadmap.railway.com then I think the problem is that when a request with host roadmap.railway.com arrives at Railway it's not clear where to route the request since that domain is not in our Railway project per se, assuming we have the domains productlane.com and *.productlane.com in Railway.
3 years ago
if you had productlane.com in railway, wouldnt you just need to set the cname domain railway gave you as the cname value for productlane.com
Unfortunately that doesn't work. The traffic from the custom arrives at Railway but then Railway doesn't know where to route the traffic to since the "host" header doesn't contain productlane.com is my understanding so far
3 years ago
why wouldn't the host contain productlane.com ? what would the host contain instead?
the host contains "roadmap.railway.com" in that example. When I tried to set this up the Railway "Not found" screen showed up when going to the custom domain.
3 years ago
maybe the fact that you are using domains you down own in your example is throwing me off, could you restructure your example with example domains you do own?
OP - you're going to have the same challenge with Railway as similar platforms (DO Apps, etc).
In our project on Railway we currently have the custom domains "productlane-dev.com" and "*.productlane-dev.com". For our customers we want to provide the functionality to host their roadmap/changelog on their custom domain. So using Cloudflare for Saas I now created "roadmap.pgvr.dev" to host my roadmap page. "roadmap.pgvr.dev" now shows the Railway not found screen.
The DNS records are in the picture and the CNAME value of "roadmap.pgvr.dev" is "pgvr.customers.productlane-dev.com"

I know :/ It works with AWS currently where we specify the hostname of the load balancer directly as the CNAME value "productlane-dev.com"
3 years ago
ah i see what you mean now
3 years ago
going to tag in @angelo for this one
I have my eye on this too. This will come up in the future for our org.
Short term plan is a different deployment (service) for the front end app for each client, but scaling is a concern.
3 years ago
i believe there should be a railway solution for this, if there isn't already, since this is not the first time ive seen someone have this use case
@Brody @angelo Is there a solution nowadays? Last update here is from over 2 years ago. Currently planning to move my whole SaaS over to Railway from Vercel and I need to know if there is a proper solution for this now
3 months ago
We do host based routing, so you would need to overwrite the host header in Cloudflare, otherwise you will always get a 404.
9 days ago
Hey, @brody Could you elaborate further? I need the custom hostname feature for my SAAS and this is a dealbreaker as well. Even on the upper plans, you are limited to like 20 domains only which is not even nearly enough.