Cloudflare for Saas domains compatible with Railway?

pgvrHOBBY

2 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

0 Replies

pgvrHOBBY

2 years ago

071f7771-ab05-488c-b53b-47a7ec81aac1


2 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?


pgvrHOBBY

2 years ago

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](roadmap.railway.com) then I think the problem is that when a request with host [roadmap.railway.com](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](productlane.com) and *.[productlane.com](productlane.com) in Railway.


2 years ago

if you had [productlane.com](productlane.com) in railway, wouldnt you just need to set the cname domain railway gave you as the cname value for [productlane.com](productlane.com)


pgvrHOBBY

2 years 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](productlane.com) is my understanding so far


2 years ago

why wouldn't the host contain [productlane.com](productlane.com) ? what would the host contain instead?


pgvrHOBBY

2 years 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.


2 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?


brianjmHOBBY

2 years ago

OP - you're going to have the same challenge with Railway as similar platforms (DO Apps, etc).


pgvrHOBBY

2 years 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"

1145769738438459600


pgvrHOBBY

2 years 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"


2 years ago

ah i see what you mean now


2 years ago

going to tag in @angelo for this one


brianjmHOBBY

2 years 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.


brianjmHOBBY

2 years ago

Or we may just roll our own load balancer, as we have before.


2 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


ramezjHOBBY

8 months ago

Hello, I'm currently facing the same problem, is anyone able to help?


Cloudflare for Saas domains compatible with Railway? - Railway Help Station