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?32 Replies
Project ID:
87f6d50b-7bab-488e-b802-02f9edc442e3
87f6d50b-7bab-488e-b802-02f9edc442e3
lets see the domains in the service settings please
Sure, I can't access the backend at all rn
yeah i know 😦
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?you could do it in code depending on what kind of app you are running?
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
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
So, I don't have the
www
subdomain in the current service at all.correct
I'm willing to move to another domain provider to avoid deploying a service just for redirection. Any provider that does support that?
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
Thanks for the help @Brody !
no problem!
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?nope, I don't know what thread you read lol
never do anything with a records until railway has static ips
I also don't see any mention of A records?
Well, you've been correct more than a few times these two days...
I've been doing this a while
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?
you can, that wouldn’t redirect anything though, i was under the impression that you wanted www -> non www
You’re right :/
django right? is a middleware that reads the host and sends a redirect that difficult or clunky?
@Brody sorry to bother you again but according to this page an A record should do?
https://www.namecheap.com/support/knowledgebase/article.aspx/385/2237/how-to-redirect-a-url-for-a-domain/
@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.
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
@Brody isn’t it considered best practice to redirect before the app layer? Or am I making stuff up here?
if you have the redirect middleware at the top, i cant see any issues for most low to medium load scenarios
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?
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!