19 days ago
Hey !
I have a question about custom domain.
The domain is already connected but I have the following issue.
For example I open https://www.abc.com I can see my service.
But when I am opening https://abc.com its not showing anything.
Is there a certain way to connect the domain, that it is available on both ?
Best Regards
Pinned Solution
19 days ago
Hey! The key thing with Railway specifically: Railway treats www.abc.com and abc.com as two completely separate custom domains — you need to add BOTH of them manually in your service settings (Service → Settings → Networking → Custom Domain).
Once you add both, Railway will give you two separate CNAME targets. Then in your DNS provider:
- For www → add a CNAME record pointing to the target Railway gives you for www.abc.com
- For @ (root domain) → add a CNAME record pointing to the target Railway gives you for abc.com (most DNS providers like Cloudflare support CNAME flattening on root, so this works fine)
If your DNS provider doesn't support CNAME on root, use an ALIAS or ANAME record instead — do NOT use a plain A record unless Railway explicitly gives you a static IP (they don't by default).
After adding both domains in Railway and setting up both DNS records, both abc.com and www.abc.com will serve your service independently.
4 Replies
Status changed to Awaiting Railway Response Railway • 19 days ago
19 days ago
Hello,
You need to check the DNS settings in your hosting provider’s panel, specifically the @ (root domain) and www records.
Currently, it appears that only the www version of the domain is properly connected.
Please verify the following:
Make sure the www record is set correctly:
Type: CNAME
Host/Name:
wwwValue: Points to your service provider’s target address
Check the @ (root domain) record:
If supported, set it as a CNAME pointing to the same target as
wwwIf CNAME is not allowed for root domains, create an A record pointing to the correct IP address provided by your service
Alternatively, you can set up a 301 redirect from abc.com to www.abc.com, which is generally recommended for consistency and SEO purposes.
After updating the DNS records, please allow some time for DNS propagation.
19 days ago
Hey! The key thing with Railway specifically: Railway treats www.abc.com and abc.com as two completely separate custom domains — you need to add BOTH of them manually in your service settings (Service → Settings → Networking → Custom Domain).
Once you add both, Railway will give you two separate CNAME targets. Then in your DNS provider:
- For www → add a CNAME record pointing to the target Railway gives you for www.abc.com
- For @ (root domain) → add a CNAME record pointing to the target Railway gives you for abc.com (most DNS providers like Cloudflare support CNAME flattening on root, so this works fine)
If your DNS provider doesn't support CNAME on root, use an ALIAS or ANAME record instead — do NOT use a plain A record unless Railway explicitly gives you a static IP (they don't by default).
After adding both domains in Railway and setting up both DNS records, both abc.com and www.abc.com will serve your service independently.
19 days ago
Thank you soo much for helping. Thats the solution. Amazing! Thank you.
Status changed to Open sam-a • 18 days ago
18 days ago
Glad it's working! Just a heads up, the second community reply is the correct answer here. Both www.abc.com and abc.com need to be added as separate custom domains in your service settings, and your DNS provider needs to support CNAME flattening or ALIAS records for the root domain. The first reply's suggestion to use A records isn't accurate for our platform. Please accept the second answer so the bounty goes to the right person!
Status changed to Solved sam-a • 18 days ago
