SaaS with custom hostnames

11 hours ago

Hi everyone!

I'm working on a SaaS with custom hostnames support hosted on Railway and am running into a bit of a problem:

We're using Cloudflare for SaaS to serve custom hostnames. We managed to get this to work using a TCP proxy on Railway so we have a raw port, and then just creating a reroute rule (or whatever it's called) to change the port to the one given. The problem however is that as far as i can see Cloudflare SaaS doesn't support apex (root domain) proxying, so we will need some other way to redirect users to the www version. I was thinking of a simple VPS or something but was wondering if you have any better ideas. (rerolling the tcp proxy until we get port 80? :)

$20 Bounty

2 Replies

Railway
BOT

11 hours ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway about 11 hours ago


Best option is to Use a cloudflare worker as it's serverless.

You can also deploy Nginx image or tinyCandy that catches traffic and shoots a 301 redirect. Managing your primary zones could leverage cloudflare page Rules under Rules tab.

Apex domains require A or AAAA record, you have to use a DNS provider that supports CNAME flattening.


If you're using Cloudflare's DNS service, you should be able to set up WAF such that all traffic to @ is redirected to www, though Cloudflare's DNS service itself already supports CNAME flattening.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...