10 months ago
I created a custom domain and other subdomains on 2 environments on railway (staging and production) and added all 3 CNAMES to Cloudflare with Proxy On and Full Mode.
The subdomains worked like a charm but the root domain (@ on CNAME) doesn't work. On Cloudflare there is a little info icon next to it saying: "CNAME records normally can not be on the zone apex. We use CNAME flattening to make it possible." and when I visit the website I see DNS_PROBE_FINISHED_NXDOMAIN
10 Replies
10 months ago
I made it work but only a CNAME redirecting to the custom domain (instead of adding a custom domain on railway)
10 months ago
You would want to add that domain to your Railway service and then add the given CNAME to Cloudflare.
10 months ago
That it what I did initially and it did not want to work. I waited for 2 or 3 hours and it still gave me the same error. I then removed the domain and just created a CNAME to the actual railway domain I had already for the project, waited for like an hour and it finally worked.
10 months ago
I would recommend doing it the correct way, otherwise we can't guarantee your domain will work long term.
10 months ago
But the correct way doesn't work. I also checked other accounts I have on railway using old projects and realized I also used this method to get the apex domain to work.
10 months ago
It does, if it doesn't it would mean you are doing something slightly wrong.
10 months ago
The steps are the following:
1- Add a custom domain
2- Copy the CNAME record from the popup that shows
3- Go to Cloudflare
4- Add the record.
How slightly can we be wrong?
Other relevant detail: Having the SSL mode as Full or Full Strict (tried both)
10 months ago
At a high level those are indeed the steps, but there is lots of places to go wrong.
10 months ago
Such as?