3 months ago
I was able to setup my customer root domain for my website and it works fine. However, when I set up my www domain, I get a "Not Found. The train has not arrived at the station" message when I click on the URL.
I am using CloudFlare DNS.
In CloudFlare, my root record is using CNAME @ and pointing to the address that Railway provided when I added the custom domain for the root. This one works fine.
In CloudFlare, my www record is using CNAME www and pointing to the address that Railway provided when I added the custom domain for www. This is the one that results in the error message.
The error message displays when I click on the www URL from within the Network section in Railway as well as when I type the www URL in a web browser.
9 Replies
3 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
3 months 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 • 3 months ago
3 months ago
Unfortunately, none of these solved the issue. I still get the 404 not found even when I click on the www custom domain when I'm in the Networking section of Railway. Looking at the setup in Railway and Cloudflare, they are using the same ports, so I'm not sure why Railway gives that message.
3 months ago
Hey there, can you confirm whether or not the domain provided by railway for the @ and www are identical to each other? Are you running these behind a cloudflare proxy (the orange cloud icon in your DNS panel) or is "DNS Only" selected?
smoke3785
Hey there, can you confirm whether or not the domain provided by railway for the @ and www are identical to each other? Are you running these behind a cloudflare proxy (the orange cloud icon in your DNS panel) or is "DNS Only" selected?
3 months ago
Thanks for the reply, smoke3785. When I created the custom records in Railway for @ and www the URLs that were provided were different for each (for example purposes, lets call them xxxx1.up.railway.app and xxxx2.up.railway.app ). So I used each one Railway provided for my Cloudflare DNS records. The address provided by Railway for www (xxxx2.up.railway.app) is the address that Cloudflare sent to when I use www.mydomain - but xxxx2.up.railway.app shows the "404 Not Found - The train has not arrived message". The root one (xxxx1.up.railway.app) has always worked fine.
I have since looked at other Railway documentation and found these Cloudflare-specific instructions (https://docs.railway.com/guides/public-networking):
Create a Custom Domain in Railway for your root domain (e.g.,
mydomain.com). Copy thevaluefield. This will be in the form:abc123.up.railway.app.Add a
CNAMEDNS record to Cloudflare:Name→@.Target→ thevaluefield from Railway.Proxy status→on, should display an orange cloud.Note: Due to domain flattening,
Namewill automatically update to your root domain (e.g.,mydomain.com).
Add another
CNAMEDNS record to Cloudflare:Name→www.Target→@Proxy status:→ on, should display an orange cloud.Note: Cloudflare will automatically change the
Targetvalue to your root domain.
I have since deleted the second www custom entry on the Railway side (xxxx2.up.railway.app) and tried the steps above. Interestingly, I get the exact same results - including Railway showing the xxxx2.up.railway.app URL and still getting the 404 error. There isn't anything that shows that address in Cloudflare - only xxxx1.up.railway.app. I has been about 24 hours since I made that last change.
Thanks!
mardonedias
Try disabling cloudfalare proxy for domains
3 months ago
Thanks for the reply, mardonedias. I haven't tried that yet. If it isn't too much trouble, would you mind looking at my response to 3785 above? I tried a different route based on other instructions I found. Those instructions indicated that proxy should be on. I'll admit that I don't exactly know that that means, so any advice is appreciated.
3 months ago
I tested it here and it worked correctly.
Consider that you have a service on Railway and want to access it through the root domain and the www subdomain. You would only need to add a DNS for the root and one for the www, pointing to Railway.
Remember that when configuring the domain on Railway, you need to specify the app's access port, the same port for both.
If this procedure isn't working, then there's some other information missing.
Below are prints of the tests performed:
Another thing to note is that you should check if your application is loading from the root path. You may need a path extension.
For example, the root address would be www.domain.com, but you need to add an extension to access the app at www.domain.com/v1.
Attachments
3 months ago
Perhaps I missed this in the thread, but if you allow Railway to automatically generate a public url for you, does it resolve then? If not, your issue is with your application configuration - not your DNS.
I just confirmed that my sites have the exact DNS configuration you described and they work fine (with Cloudflare proxy enabled) - I suspect there's something wrong with your app config.
3 months ago
Thanks again, smoke3785 and mardonedias! Based on your advice, I went back to my original configuration with 2 custom entries on the Railway side (root and www). I then went back to 2 entries in Cloudflare as you described above. It didn't work initially and I got the same result. However, after waiting a few minutes and trying on different browsers it started working. This browser was the last one with the issue, but after clearing the cache and waiting a few minutes it started to work. Thanks again for your advice and patience!
Status changed to Solved noahd • 3 months ago