R
Railwayβ€’2mo ago
tjh

Cloudflare bare domain configuration

Hi folks, Have struggled to get my bare domain and www. working with Cloudflare, have read the Railway docs, and Cloudflare ones, and have tried many different settings, have ended up giving up, and now I'm here. Here are the latest steps I've followed, could you please tell me where I'm going wrong? 1. In Railway: add a custom domain for mydomain.com 2. In Cloudflare: add a CNAME for Name = @, target = <host>.up.railway.app -> the name of this DNS record automatically changes to mydomain.com 3. In Railway: add a custom domain for www.mydomain.com 4. In Cloudflare: add a CNAME for Name = www, target = <other_host>.up.railway.app After these steps, I can see Cloudflare proxy detected on both custom domains in Railway. Both my CNAME records are Proxied on Cloudflare. When I do this, the www. version works, the bare domain doesn't (I get 'this site can't be reached' in the browser). I've tried changing SSL/TLS mode from Full to Flexible in Cloudflare, still doesn't work. I've tried disabling Universal SSL/re-enabling, same thing. I only have one other DNS record, which is a TXT to auth with another service. Any help appreciated! Project ID: c18400df-5dee-4fe7-bc56-a98db8d475bd
Solution:
I had to 1. create a custom domain in railway for my bare domain 2. create a CNAME for bare domain, pointing to the railway host 3. create a CNAME for www pointing to @ 4. enable Universal SSL...
Jump to solution
57 Replies
Percy
Percyβ€’2mo ago
Project ID: c18400df-5dee-4fe7-bc56-a98db8d475bd
tjh
tjhβ€’2mo ago
(FYI, I've just gone through this again while writing this, and now the bare domain works and the www. doesn't πŸ™ˆ )
Fragly
Fraglyβ€’2mo ago
If you want both to work like that then you'll need to add two custom domains, a www.mydomain.com one and a mydomain.com one Although my recommendation would be to choose one of them and then have the other redirect to your chosen one, this keeps things more consistent
tjh
tjhβ€’2mo ago
I have two custom domains I'd be happy to do the redirect - I have tried that in Cloudflare using a Redirect Rule - I think I must have done that wrong, as it didn't work
Fragly
Fraglyβ€’2mo ago
Oh I see now, sorry I misread πŸ™ Based on how you set it up, it should work πŸ€” Quick side note here:
I've tried changing SSL/TLS mode from Full to Flexible in Cloudflare, still doesn't work
SSL/TLS mode should always be on full when on Railway
tjh
tjhβ€’2mo ago
Full strict, or just Full?
Fragly
Fraglyβ€’2mo ago
Just Full is fine
tjh
tjhβ€’2mo ago
cool if you're doing the redirect, is the best thing to set up a custom domain for the bare, or for www., domain in railway?
Fragly
Fraglyβ€’2mo ago
that's completely up to you, personally I like it when websites don't use www but that's just personal preference 🀣
tjh
tjhβ€’2mo ago
and you set up the redirect in Cloudflare using a Redirect Rule? also, should Universal SSL be on?
Fragly
Fraglyβ€’2mo ago
I believe so, although I'm not very experienced with Cloudflare so I can't really help a lot in that context No, that should be turned off
tjh
tjhβ€’2mo ago
ok, so I've just: 1. Removed my custom domains 2. Added mydomain.com (the bare url) 3. Added a CNAME for @ and <host>.up.railway.app to Cloudflare 4. Disabled Universal SSL and now none (www.mydomain.com, http://mydomain.com, https://mydomain.com and https://www.mydomain.com) of my urls are working
Fragly
Fraglyβ€’2mo ago
Would you mind sharing the domain you're using?
tjh
tjhβ€’2mo ago
DMd
Fragly
Fraglyβ€’2mo ago
Seems the cause is a ERR_SSL_VERSION_OR_CIPHER_MISMATCH, usually these resolve themselves and are usually caused by SSL cache
Want results from more Discord servers?
Add your server