I’ve been working on integrating ESI (Edge Side Includes) into my OctoberCMS project and have run into some challenges. My aim is to have certain dynamic parts of my site uncached, while the rest benefits from caching, hence the need for ESI.
So far, here’s what I’ve attempted:
-
Custom Middleware: I created custom middleware named
NoCacheMiddleware
to set no-cache headers for specific routes. However, I encountered the “Target class does not exist” error even after confirming the namespace and directory structure. -
Composer Autoload: Tried regenerating Composer’s autoload with
composer dump-autoload
and also cleared the OctoberCMS cache. -
Using
barryvdh/laravel-httpcache
: I thought this package might simplify the integration as it provides tools for ESI in Laravel. I followed the package documentation, enabled ESI in the config, added the required middleware, and set up routes for ESI includes. However, I kept encountering various issues like a “Call to undefined method” error.
I’ve also ensured the web server supports ESI, and I believe my setup respects OctoberCMS conventions.
Has anyone successfully implemented ESI with OctoberCMS? If so, could you share how you achieved it or provide any insights on where I might be going wrong? Any help or pointers would be greatly appreciated.