Subdomain (www) redirecting using dnsimple and Modulus, or, how to read


#1

tl;dr: Read docs closely.

I recently moved a site to Modulus. They don’t provide subdomain redirects. In particular, redirects from “www.foo." to "foo.”. They have helpful docs on this.

After trying to use the CNAME I was using with the previous provider, different Modulus IP’s, “onmodulus” URL’s, and different CNAME combinations to no avail, I emailed Modulus. They were prompt and helpful, and recommended a code-level redirect, or a DNS redirect per their post.

We had written something simple in a Meteor.startup on the server, following meteorpedia’s post. This worked fine, but wasn’t replacing the content of the browser’s URL bar with the URL it was redirecting to. This was messy for copy-paste URL sharing.

Altogether too long after hitting this wall, I reached out to the community, including the Meteor Club Slack (I contribute to the Patreon for the meteor podcast). After some back and forth @jeremy replied, promptly informing me that my DNS (dnsimple), should support it. I had read their docs on this, but somehow missed that they call their redirect records “URL records”. I deleted the old CNAME redirect, created a URL record, and bam, it was working instantly in zero propagation time.

I suppose the moral of the story is “always read a little bit further after you think you’ve read it all”. In retrospect, this seems dumb, but I wanted to post it lest others get frustrated (like I did) trying to figure this out.

Thanks meteor community for the help! Thanks @jeremy and @eymiha!