I'm using Craft Pro 3.6 in Headless mode. I've found that caching the GraphQL responses on the frontend server dramatically speeds up our load time, even with enableGraphQlCaching turned on.

What I'd like to do is have Craft make a cUrl request to an endpoint on our frontend server whenever an entry is published or updated(or whenever the cache busting script would normally run) to clear the frontend cache.

I'm guessing the best approach would be a custom plugin? However, if there's an easier way to do this I'm all ears.

Thanks for your time.

1 Answer 1


Sounds like a custom plugin or module would work for you here, allowing you to hook into the entry after save event.

use craft\elements\Entry;
use craft\events\ModelEvent;
use yii\base\Event;

    function(ModelEvent $event) {
        $entry = $event->sender;

        if (!$entry->getIsDraft()) {
            // Make the request to clear caches on the frontend.

  • Perfect, this is just what I was after. Thank you!
    – Tao
    Commented Apr 30, 2021 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.