… yes, even more BunnyCDN content!
Over the past few weeks, I’ve been diving deep into integrating Bunny.net’s CDN into Magic Pages’s hosting. The previous CDN setup—using a storage adapter—wasn’t quite cutting it.
BunnyCDN is fantastic—it’s easy to set up with Ghost, but getting everything just right isn’t trivial.
One challenge was dealing with Perma-Cache. Without it, performance improved, but it still wasn’t on par with Ghost(Pro)'s Fastly network. However, enabling Perma-Cache set the cache duration to one year—way too long for anyone updating their Ghost blog regularly.
Then, a few weeks ago, I stumbled upon this old issue on GitHub—and almost 11 years later, I was thrilled to see that the X-Cache-Invalidate
header is still in play
That discovery sparked an idea: why not create something that monitors this header and triggers a cache invalidation API call to BunnyCDN? But because of some other priorities, I put it on a back burner.
Then, after seeing @FanyangMeng’s recent post, I kept thinking about it, and came up with a solution that seamlessly integrates into the Magic Pages’s stack. And because sharing is caring, here it is:
Long story short: If you’re running Ghost in Docker, integrating this Perma-Cache purger will literally just take a few seconds—provided you have BunnyCDN set up.
Eager to hear your feedback and thoughts on this integration!