Problem with gzip middleware
Hello, for some reason when setting up my gzip middleware I'm getting a blank page on filament panels. The middleware is working fine for non-filament pages. I think the problem is related to some script not loading correctly after decompressing, but I'm not completely sure. Does anyone have any idea of what could be happening? Thanks.
//Middleware
class GzipEncodeResponse
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
$response = $next($request);
if (in_array('gzip', $request->getEncodings()) && function_exists('gzencode')) {
$response->setContent(gzencode($response->getContent(), 9));
$response->headers->add([
'Content-Encoding' => 'gzip',
'X-Vapor-Base64-Encode' => 'True',
]);
}
return $response;
}
3 Replies
I have the same problem. Still not resolved.
Solved it - solution here: https://laracasts.com/discuss/channels/filament/filament-and-gzip-content-issue?page=1&replyId=938468
I can confirm the posted solution works ^