R
Railway10mo ago
Patrick

Cloudflare for Saas domains compatible with Railway?

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
Cloudflare for SaaS · Cloudflare for Platforms docs
Cloudflare for SaaS allows you to extend the security and performance benefits of Cloudflare’s network to your customers via their own custom or …
15 Replies
Percy
Percy10mo ago
Project ID: 071f7771-ab05-488c-b53b-47a7ec81aac1
Patrick
Patrick10mo ago
071f7771-ab05-488c-b53b-47a7ec81aac1
Brody
Brody10mo 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?
Patrick
Patrick10mo ago
I'm not sure what you mean. Every customer uses their existing dns provider, Cloudflare gives us just a CNAME address and _acme_challenge 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.
Brody
Brody10mo 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
Patrick
Patrick10mo ago
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
Brody
Brody10mo ago
why wouldn't the host contain productlane.com ? what would the host contain instead?
Patrick
Patrick10mo ago
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.
Brody
Brody10mo 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?
BrianJM
BrianJM10mo ago
OP - you're going to have the same challenge with Railway as similar platforms (DO Apps, etc).
Patrick
Patrick10mo ago
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"
Patrick
Patrick10mo ago
I know :/ It works with AWS currently where we specify the hostname of the load balancer directly as the CNAME value "productlane-dev.com"
Brody
Brody10mo ago
ah i see what you mean now going to tag in @Angelo for this one
BrianJM
BrianJM10mo ago
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. Or we may just roll our own load balancer, as we have before.
Brody
Brody10mo 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