forked from laysense/laysite
Launch LaySite visual editor and MCP workspace
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use Webman\Http\Request;
|
||||
use Webman\Http\Response;
|
||||
use Webman\MiddlewareInterface;
|
||||
|
||||
final class PublicAssets implements MiddlewareInterface
|
||||
{
|
||||
public function process(Request $request, callable $handler): Response
|
||||
{
|
||||
$response = $handler($request);
|
||||
$path = $request->path();
|
||||
if (str_starts_with($path, '/assets/')) {
|
||||
$response->withHeader('Access-Control-Allow-Origin', '*');
|
||||
if ($path === '/assets/jquery-4.0.0.min.js') {
|
||||
$response->withHeader('Cache-Control', 'public, max-age=31536000, immutable');
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user