HandleCors
class HandleCors
Properties
| protected Container | $container | The container instance. |
|
| static protected null|Request): array | $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 37
__construct(Container $container)
Create a new middleware instance.
at line 83
protected bool
hasMatchingPath(Request $request)
Get the path from the configuration to determine if the CORS service should run.
at line 103
protected array
getPathsByHost(string $host)
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.
Boot-only. 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 136
static void
skipWhen(Closure $callback)
Register a callback that instructs the middleware to be skipped.
Boot-only. Skip callbacks persist for the worker lifetime and run on every subsequent request.
at line 144
static void
flushState()
Flush all static state.