HandleCors
class HandleCors
Properties
| protected Container | $container | The container instance. |
|
| static protected null|Request): array<string, mixed> | $configResolver | The closure used to resolve CORS configuration for the current request. |
|
| static protected Request): bool> | $skipCallbacks | All of the registered skip callbacks. |
Methods
Get the path from the configuration to determine if the CORS service should run.
Get the CORS paths for the given host.
Register a closure that resolves CORS configuration for the current request.
Flush all static state.
Details
at line 39
__construct(Container $container)
Create a new middleware instance.
at line 86
protected bool
hasMatchingPath(Request $request, array $paths)
Get the path from the configuration to determine if the CORS service should run.
at line 109
protected array
getPathsByHost(string $host, array $paths)
Get the CORS paths for the given host.
at line 125
static void
resolveConfigUsing(Closure|null $callback)
Register a closure that resolves CORS configuration for the current request.
The closure receives the current request and returns the CORS options array; useful for multi-tenant CORS where the config varies by host or other request data. Persists for the worker lifetime.
at line 137
static void
skipWhen(Closure $callback)
Register a callback that instructs the middleware to be skipped.
Skip callbacks persist for the worker lifetime and run on every subsequent request.
at line 146
static void
flushState()
Flush all static state.