Downtime after release (caused by DNS), how I fixed it
What's up, folks! I'm writing a short post to let you know about an issue that I've had with my website, so that you can learn from it.
As you may know, this website is still quite new, and I'm still polishing up many things. At first, I was afraid that people would hate it because this is the first time I've made my own website. There were three other times, but all of them were disasters.
And, to my surprise, you people loved it! Many added the feed (available both as RSS/ATOM and JSON) to their reader, praised its design philosophy, laughed at the 404 page, and awwed at the logo.
The glory did not end just there—not at all! PageSpeed insights rated this website a whopping 100% on all rates (Performance, Accessibility, Best Practices, and SEO).
Needless to say, this website was a total success to me. I'm very happy with how everything turned out, and I will sure be forking it when I want to make more. Though, this glory couldn't have lasted forever.
As many of you know, this website is fully self-hosted at home. As such, I need to make use of DDNS in order to update the DNS entries, so that you can access it from libreivan.com. This has the advantage of increased security and speed (theoretically), which I appreciate.
What I didn't know, though, was that my domain provider, had a default TTL of 24 hours which would make my site go down for said amount of time.
Wait, but what is TTL?
I'm sure none of my readers are wondering this, but I'd still like to provide a quick explanation to those non-techie people, just in case.
Time to Live (TTL) is a field on DNS records (AKA, domain info) that controls how long each record is valid and — as a result — how long it takes for record updates to reach users.
Longer TTLs speed up DNS lookups by increasing the chance of cached results, so that you don't need to look them up unnecessarily in some cases, but a longer TTL also means that updates to your records take longer to go into effect.
So, if the TTL of a record is set to 24 hours, it will take around that time or less to update, with the added benefit that your site will be faster.
How TTL made my site go down
As I said earlier, my domain provider has a default TTL of 24 hours, which means that whenever I update a record, it will take around that amount of time (or less) to update.
I was not aware of this, however, my dynamic IP address decided to change, as it always does. This is when chaos ensured.
I noticed libreivan.com was inaccessible, so I checked my DNS records with the domain provider. To my surprise, the IP matched, and everything was working correctly. But for some reason, web browsers were trying to get the data from the old IP address.
I think what was going on is quite obvious now that I have presented the issue to you firsthand, but when it happened, I was flabbergasted. The DDNS service on my server successfully updated the records, so there was nothing wrong in theory.
How I fixed it
After a bit of research, I finally found out about my domain provider's insane default TTL value. I changed it to 5 minutes and called it a day. After that, my website came back.
Yup, it was actually a really simple fix. Confusing nonetheless. I don't understand why the default TTL value for dynamic records has to be 24 hours, but it's not cool.
If you run your site with DDNS, please do your own research and don't make the same mistake as I did.
I hope this post was useful. Stay hydrated! 🤗
Proudly written by Ivan.
Ivan is a young and passionate libre software advocate and coder, main author and designer of this website. He's been proudly embracing the open web and giving back to the open source community ever since he was 13 years old.
This post has not been: - Sponsored. - Written by AI. - Made by somebody else other than the author stated above. - Eating your apple pie in secret.