R
Railway•10mo ago
SHxKM

Am I doing something wrong with custom domains? (Namecheap)

So I configured mydomain.online on Railway, and then went to Namecheap and entered (see screenshot). It's been about 20 minutes and no dice yet. Also, I'd like to have www.mydomain.online to always go to the apex/root. Should I change stuff right in order to not have issues later down the road?
No description
32 Replies
Percy
Percy•10mo ago
Project ID: 87f6d50b-7bab-488e-b802-02f9edc442e3
SHxKM
SHxKMOP•10mo ago
87f6d50b-7bab-488e-b802-02f9edc442e3
Brody
Brody•10mo ago
lets see the domains in the service settings please
SHxKM
SHxKMOP•10mo ago
Sure, I can't access the backend at all rn
Brody
Brody•10mo ago
yeah i know 😦
SHxKM
SHxKMOP•10mo ago
OK, mydomain.online is resolving correctly. What's the correct way to have the www redirect to the apex? Do I need to do this on Railway, or on Namecheap?
Brody
Brody•10mo ago
you could do it in code depending on what kind of app you are running?
SHxKM
SHxKMOP•10mo ago
I really don't want to do that in code :/ had that going on with Heroku and it was a nightmare with Django. Just felt real dirty
Brody
Brody•10mo ago
fair, well namecheap cant do https redirects, so that not an option, how about this https://github.com/brody192/domain-redirect-template you would remove the www subdomain from your current service, deploy this repo as a new service and put the www subdomain on that service
SHxKM
SHxKMOP•10mo ago
So, I don't have the www subdomain in the current service at all.
Brody
Brody•10mo ago
correct
SHxKM
SHxKMOP•10mo ago
I'm willing to move to another domain provider to avoid deploying a service just for redirection. Any provider that does support that?
Brody
Brody•10mo ago
cloudflare can with page rules, you would need to have the www subdomain on the service for that (so that it will have a valid cert) you'd only need to use cloudflare's nameservers
SHxKM
SHxKMOP•10mo ago
Thanks for the help @Brody !
Brody
Brody•10mo ago
no problem!
SHxKM
SHxKMOP•10mo ago
Just saw a thread where it was possible to link both domains foo.com and www.foo.com in the same Railway service, and then play around with A records?
Brody
Brody•10mo ago
nope, I don't know what thread you read lol never do anything with a records until railway has static ips
SHxKM
SHxKMOP•10mo ago
Yeah nevermind, those were two apps.
Brody
Brody•10mo ago
I also don't see any mention of A records?
SHxKM
SHxKMOP•10mo ago
Well, you've been correct more than a few times these two days...
Brody
Brody•10mo ago
I've been doing this a while
SHxKM
SHxKMOP•10mo ago
Coming back to this @Brody, why can’t I add both the apex and the www to Railway, and just put two CNAME records at Namecheap?
Brody
Brody•10mo ago
you can, that wouldn’t redirect anything though, i was under the impression that you wanted www -> non www
SHxKM
SHxKMOP•10mo ago
You’re right :/
Brody
Brody•10mo ago
django right? is a middleware that reads the host and sends a redirect that difficult or clunky?
SHxKM
SHxKMOP•10mo ago
@Brody last time I tried it (6 years ago) I was a beginner programmer so I may have overstated how clunky it is. Or understated how clunky I was.
Brody
Brody•10mo ago
please do not use A records for anything railway related, railway will only ever provide you with a cname and last i checked, namecheap doesn’t do https redirecting
SHxKM
SHxKMOP•10mo ago
@Brody isn’t it considered best practice to redirect before the app layer? Or am I making stuff up here?
Brody
Brody•10mo ago
if you have the redirect middleware at the top, i cant see any issues for most low to medium load scenarios
SHxKM
SHxKMOP•10mo ago
This looks like it should do, but it says:
…You should also make sure your HTTPS certificate includes both domains.
I guess this is handled by Railway?
Brody
Brody•10mo ago
You should also make sure your HTTPS certificate includes both domains... I guess this is handled by Railway?
as long as you have both your www and your bare domain in the custom domains, yes, both will receive certs!
Want results from more Discord servers?
Add your server