Skip to content
is there a way to connect railway to a custom domain without @
rafatiranube
OP

a year ago

Hi team. Our current website is hosted on a non-node.js hosting. I'm working on the new site, which is next js. Thing is, altering cname @ would mess up our email (mail record). Is there a way to only point to root and leave the rest of the records intact?

$20 Bounty

4 Replies


a year ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody • about 1 year ago


saerio

a month ago

change your mx record to point to a subdomain like mail. and add your mailserver IPs there, then swap the #, i migth be misunderstanding your setup here though.


saerio

a month ago

wait does your dns provider support cname flattening?


Anonymous

a month ago

Yes. For the smallest change, attach www.example.com to your Railway service and add the CNAME plus ownership-verification TXT record Railway supplies for that hostname. Leave the apex (@) and existing mail records alone; if your current web host supports HTTP redirects, it can redirect the apex website to www.

If you want the apex itself served by Railway, your DNS provider must support apex CNAME flattening or a dynamic ALIAS/ANAME. Use the Railway-provided target and verification TXT; do not replace MX records with an ordinary apex CNAME. Railway documents this here:

https://docs.railway.com/networking/domains/working-with-domains#adding-a-root-domain

Cloudflare explains why flattening returns IP addresses instead of a conflicting apex CNAME:

https://developers.cloudflare.com/dns/cname-flattening/

Before changing @, check whether mail depends on its address: for example, an MX target of example.com, mail.example.com aliased to @, or an SPF a/a:example.com mechanism. Those dependencies need a mail-provider-approved configuration retaining the actual mail-server address. Keeping MX text unchanged alone would not protect that setup. Preserve DKIM/DMARC and other mail records too.

Which DNS provider do you use, and does your MX target point to a dedicated mail host or back to the apex? Record types and anonymized hostnames are enough; please do not post credentials.

AI-assisted; checked against the linked official documentation. This is a configuration explanation, not a claim that your DNS has been changed.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...