OriginAllowlistMiddleware
in package
implements
MiddlewareInterface
Read onlyYes
FinalYes
Tags
Table of Contents
Interfaces
- MiddlewareInterface
Methods
- __construct() : mixed
- process() : ResponseInterface
Methods
__construct()
public
__construct(array<int, string> $allowedOrigins[, bool $allowMissingOrigin = true ][, array<int, string> $safeMethods = [] ][, ResponseFactoryInterface|null $responseFactory = null ]) : mixed
Parameters
- $allowedOrigins : array<int, string>
-
Exact origins (scheme://host[:port]) to accept.
- $allowMissingOrigin : bool = true
-
When true (default), a request with no Origin header passes; set false to require an allowed Origin on every request.
- $safeMethods : array<int, string> = []
-
HTTP methods exempt from the check (safe, non-state-changing). WebSocket upgrades arrive as GET, so GET is NOT exempt by default — the check applies to upgrades and to unsafe methods.
- $responseFactory : ResponseFactoryInterface|null = null
process()
public
process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $handler : RequestHandlerInterface
Attributes
- #[Override]