# BunnyCDN Perma-Cache Purger for Docker

**URL:** <https://forum.ghost.org/t/bunnycdn-perma-cache-purger-for-docker/48380>\
**Category:** Share & showcase\
**Created:** [June 24, 2024, 7:27pm UTC](https://forum.ghost.org/t/bunnycdn-perma-cache-purger-for-docker/48380 "2024-06-24T19:27:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jannis](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jannis/32/39718_2.png) [@jannis](https://forum.ghost.org/u/jannis)\
**Post date:** [June 24, 2024, 7:27pm UTC](https://forum.ghost.org/t/bunnycdn-perma-cache-purger-for-docker/48380/1 "2024-06-24T19:27:25Z")

</div>

… yes, even more BunnyCDN content! 🎉

Over the past few weeks, I’ve been diving deep into integrating [Bunny.net](http://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](https://www.magicpages.co/blog/setting-up-bunnycdn-with-ghost-cms/), 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](https://github.com/TryGhost/Ghost/issues/570)—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](https://forum.ghost.org/t/i-make-a-bunny-cdn-perma-cache-auto-clearer-webhook/48324), 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:

> **[GitHub - magicpages/ghost-bunnycdn-perma-cache-purger](https://github.com/magicpages/ghost-bunnycdn-perma-cache-purger)**
>
> Contribute to magicpages/ghost-bunnycdn-perma-cache-purger development by creating an account on GitHub.

**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!

---

<div class="post-metadata">

**Author:** ![FanyangMeng](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/fanyangmeng/32/25998_2.png) [@FanyangMeng](https://forum.ghost.org/u/FanyangMeng)\
**Post date:** [June 24, 2024, 7:43pm UTC](https://forum.ghost.org/t/bunnycdn-perma-cache-purger-for-docker/48380/2 "2024-06-24T19:43:05Z")

</div>

Congrats on this awesome project! I am gonna take a look! Although I am using local install for my own ghost but migrating the database to docker should not be that hard if I need to use it. I am gonna learn about your code a bit, cannot believe you made it!!!

---

<div class="post-metadata">

**Author:** ![jannis](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jannis/32/39718_2.png) [@jannis](https://forum.ghost.org/u/jannis)\
**Post date:** [June 24, 2024, 7:47pm UTC](https://forum.ghost.org/t/bunnycdn-perma-cache-purger-for-docker/48380/3 "2024-06-24T19:47:14Z")

</div>

Haha just a few lines of Express.js, nothing magical, to be honest.

You should be able to run it without Docker as well, since it’s just a single-file Node.js script. Just haven’t tested that myself 😃

---

<div class="post-metadata">

**Author:** ![jannis](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/jannis/32/39718_2.png) [@jannis](https://forum.ghost.org/u/jannis)\
**Post date:** [March 11, 2025, 1:05pm UTC](https://forum.ghost.org/t/bunnycdn-perma-cache-purger-for-docker/48380/4 "2025-03-11T13:05:01Z")

</div>

Just a quick update here. I have archived this Perma Cache purger today in favour of a more versatile solution that is CDN-independent:

> **[GitHub - magicpages/ghost-cache-invalidation-proxy](https://github.com/magicpages/ghost-cache-invalidation-proxy)**
>
> Contribute to magicpages/ghost-cache-invalidation-proxy development by creating an account on GitHub.
