HermanMartinus / bearblog

Free, no-nonsense, super fast blogging.
MIT License
2.36k stars 73 forks source link

CDN not available for custom domains #284

Closed pimoore closed 1 month ago

pimoore commented 1 month ago

Doing testing via webpagetest.org reveals that Bear blogs using a custom domain aren't using the Cloudflare CDN as the bearblog.dev ones are. Is this a bug, or is there a workaround to ensure the CDN continues to work for those using custom domains? In the example below the person has their own pull zone setup for a web font, but the domain itself has no CDN linked to it.

IMG_0289 IMG_0290

HermanMartinus commented 1 month ago

Well spotted.

Cloudflare adds a CDN on the domain level, and so all the subdomains (*.bearblog.dev) are covered by the Cloudflare CDN. You can set up Cloudflare CDN for your blog by using Cloudflare to manage your domain, and ensuring your SSL/TLS encryption mode is Full (strict). You can see this running at this demo blog.

This will give a tiny bump in performance, but for simplicity sake I recommend most people ignore adding a CDN since it doesn't materially affect performance (the page size is generally <5kb), images and fonts are behind a CDN already, and my reverse proxy issues a Let's Encrypt certificate so https is ensured.