DNS Routing Troubles

Published on Oct. 24, 2024, 11:27 p.m.

I got an email late last night letting me know that my domain name transfer had finally gone through. I initiated the transfer late last week and I'm surprised the process took so long. Now that I'm finally on Namecheap, I took some time to set up the custom DNS routing tonight. Namecheap's interface for setting up those DNS host records was actually a little more confusing than it was on Squarespace, but it didn't take too long to figure out what I had to do. Luckily Render has dedicated Namecheap documentation. Even after adding those records, and then verifying and issuing certificates with them through Render, I wasn't able to access my site through my custom domain name. I kept getting 400 Bad Request pages every time I tried. I saw this same issue last week and I thought it would be solved by switching domain name providers, so I was a little annoyed when that didn't immediately fix my problem.

 

Some more Googling led me to realize I never added my domain in my list of allowed hosts in my Render environment variables. Even after realizing this, it took some iterating on my environment variables to find the configuration that worked for me. I updated the host list to include cdeimer.com, but I was still getting 400s when hitting my domain name. At this point I checked the Django documentation which said that a period at the start of a domain name can be used as a subdomain wildcard, and will therefore match example.com, www.example.com, or blog.example.com, so I figured I'd give that a shot. I updated the value, waited for the deploy to go through, and it worked! The lesson here is to remember to update your allowed hosts when setting up a new domain name, it'll save you from transferring your domain between providers unnecessarily. Oh well, everyone on reddit says it's a good idea to get off Squarespace anyway.