Laravel Vapor gzip

Hi.
I'm trying to enable gzip responses in Laravel Vapor. I created a middleware similar to this one: https://bannister.me/blog/gzip-compression-on-laravel-vapor. I have added it to the web middleware group.

It works perfectly on all ajax requests! But the first request is never gzipped?

I tried adding my middleware under middleware in my filament panel provider. But then Filament stops working completely. I get a response with all the HTML but no navigation or ajax works.

Does anyone know how to solve this?
Was this page helpful?