Snapshot of main at 9f39a6e1e (2026-11-02)
This commit is contained in:
commit
6ccf1792d7
2580 files changed
+1040202
No files matched your search
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DisableAssetCacheInDebug
|
||||
{
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
$response = $next($request);
|
||||
|
||||
if (config('app.debug')) {
|
||||
$contentType = $response->headers->get('Content-Type', '');
|
||||
$isBinaryFile = str_starts_with($contentType, 'image/')
|
||||
|| str_starts_with($contentType, 'video/')
|
||||
|| str_starts_with($contentType, 'audio/')
|
||||
|| str_starts_with($contentType, 'application/pdf');
|
||||
|
||||
if (!$isBinaryFile) {
|
||||
$response->headers->set('Cache-Control', 'no-store, no-cache, must-revalidate');
|
||||
$response->headers->set('Expires', '0');
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user