16 days ago
Hi there, I'm trying to add the correct CNAME for my custom domain. However, my domain provider does not allow CNAME records to be added at the @ level. How can I set this up? I tried web forwarding and the CNAME on www but railway doesn't detect that
7 Replies
Attachments
16 days ago
I’d recommend migrating to Cloudflare’s DNS service. They support CNAME flattening (using CNAME records on root domains).
16 days ago
Option 1 - Cloudflare (easiest, recommended)
Move DNS to Cloudflare (free, no domain transfer needed). Add your domain in Railway, then in Cloudflare add:
CNAME → @ → Railway's CNAME target (orange cloud on)
TXT → @ → Railway's verification string
SSL mode set to Full (not Strict)
Cloudflare handles the apex CNAME limitation automatically.
16 days ago
Option 2 - www only (no DNS switch)
In Railway, delete the root domain and add www.yourdomain.com instead. Then:
CNAME → www → Railway's CNAME target
TXT → wherever Railway specifies → Railway's verification string
At your registrar, set a 301 redirect from yourdomain.com → https://www.yourdomain.com
Railway only checks the DNS slot that matches what you added in the dashboard, so pointing it to www sidesteps the root restriction entirely.
16 days ago
The issue is coming from your DNS provider requiring a value in the “Host name” field. In your screenshot the field is blank, but with this provider you usually can’t create an apex/root (@) CNAME directly.
That’s why Railway never detects the domain.
A reliable fix is:
-
In Railway, remove
yourdomain.com -
Add only
www.yourdomain.com -
In DNS create:
- Host:
www - Type:
CNAME - Target:
your-project.up.railway.app
- Host:
-
Add the TXT verification record Railway gives you
-
Then create a 301 redirect from:
yourdomain.com→https://www.yourdomain.com
This works because Railway validates the exact hostname you add. Since your registrar doesn’t support root CNAMEs, using www bypasses the limitation entirely.
If you want the naked domain (@) connected directly, you’ll need a DNS provider that supports ALIAS/ANAME or CNAME flattening (Cloudflare is the easiest free option).
16 days ago
You may be able to just change the type to an ANAME record at your current DNS provider. An ANAME record can be set at the root of the domain and is equivalent to a CNAME. For clarification: Cloudflare would "flatten" the CNAME to an ANAME record behind the scenes if it's at the root.
Status changed to Solved 0x5b62656e5d • 15 days ago