The CABlog

Writing my own CNAME flattener to use with Bear Blog

Hi all,

I self-host my email and DNS via the wonderful Mail-in-a-Box, but this lead me to face an interesting issue today. I just purchased a Bear Blog Premium Plan and decided to connect my personal domain, but I am actually using the root domain (cadawg.com) rather than a subdomain. This means that I can't technically use a CNAME record as it is unsupported in MIAB, but despite this I still wanted the benefits of using the CNAME (i.e. not having to change it if Bear Blog is ever to change hosts) as I may forget for a little while which wouldn't be great. Of course I could just settle for the static IP address, but where's the fun in that.

So I did what any programmer would do, I decided I'd write an app for it (that takes 100x longer than just setting it and changing it in the future), and so I present CNameFlatten, a tool which connects to the MIAB API and fetches any TXT records like below

_cname_flatten.cadawg.com    TXT    domain-proxy

and then fetches the domain specified in the TXT record's A (quiet/IPv4) and AAAA (screaming/IPv6) records and sets them using the MIAB DNS API, to lead to the result below.

Demo Screenshot

Woohoo! It works, and I have it running on my server every 5 mins (even though that's definitely overkill). In all fairness, I had fun making it and learned a couple things.

I'd also like to add, although I called AAAA/IPv6 records "screaming" records, I don't have any disdain for IPv6, and actually encourage it's use and have it enabled for all my sites. I also run an No IPv6 Name-and-Shame website for the top 100 sites to show who supports IPv6 and not, so I'm definitely pro-IPv6.

If you want more details about the CNAME Flattener I wrote, feel free to Read the README or ping me an email.

Anyhow, have an awesome day everyone.

~ CA

Like what I write? Subscribe to my Mailing List or RSS feed.

Comments? Questions? Feel free to send me an Email.

This post was last edited 7 months, 1 week ago.