I’m finally switching DNS for my custom domain over to my Micro.blog hosted site instead of my previous website on GitHub Pages, but I’m having trouble getting it set up the way I’d like… I use Cloudflare as my DNS provider and I have a few nit-picky details that I really prefer for my website:
- Always use HTTPS, which seems to work by default; requesting http://davidcel.is gives me a 308 redirect to https://davidcel.is
- Proxy my site’s DNS via Cloudflare for easy caching that I don’t need to worry about setting up
- Support visiting the
wwwsubdomain but redirect it to the root domain (i.e. redirect
Given Micro.blog seems set up to do that first one by default, that just leaves the other two. The last one is easy enough using a page rule on Cloudflare (which is what I used to do), but this actually depends on proxying being enabled, and I can’t seem to get my site working at all when my
CNAME records have Cloudflare’s proxy enabled. As soon as I enable that and the DNS changes take effect, trying to visit my site shows a “too many redirects” error:
Because of this, my
CNAME records are set to “DNS Only” on Cloudflare for now (no proxy). My site works okay, but I’d prefer
www to redirect to my root domain, and my uploaded images load extremely slowly. It takes one photo between 2-3s to load for me and, for some reason, those images don’t seem to be getting cached by my browser at all. I checked the HTTP request for one of my images and it shows a
Cache-Control: max-age=7200 header declaring a 2-hour cache along with the corresponding
Expires: Sat, 7 May 2022 23:45:48 +0000 header, but no ETag (not sure if that’s the issue).
Even if I could figure out the image caching issue, 2 hours is a very short expiration time for something like an uploaded image, given it’s extremely unlikely to change. Part of why I like the Cloudflare proxying is that the caching support it gives me just works and I can set a longer cache expiration time.
Anybody out there been successfully using Cloudflare and their DNS proxying feature?