Skip to content

Commit

Permalink
gzip
Browse files Browse the repository at this point in the history
  • Loading branch information
th0rn0 committed May 21, 2024
1 parent 598bde2 commit a0b5890
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions resources/docker/nginx/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ server {
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html/public;
gzip on;
gzip_types text/html text/css application/javascript image/*;

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
Expand Down
1 change: 1 addition & 0 deletions src/app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Kernel extends HttpKernel
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\CompressResponse::class,
],

'api' => [
Expand Down
21 changes: 21 additions & 0 deletions src/app/Http/Middleware/CompressResponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class CompressResponse
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
return $next($request);
}
}

0 comments on commit a0b5890

Please sign in to comment.