$_response
$_response : \Psr\Http\Message\MessageInterface
The response object this builder is attached to.
A builder object that assists in defining Cross Origin Request related headers.
Each of the methods in this object provide a fluent interface. Once you've
set all the headers you want to use, the build()
method can be used to return
a modified Response.
It is most convenient to get this object via Request::cors()
.
$_response : \Psr\Http\Message\MessageInterface
The response object this builder is attached to.
__construct(\Psr\Http\Message\MessageInterface $response, string $origin, boolean $isSsl = false)
Constructor.
\Psr\Http\Message\MessageInterface | $response | The response object to add headers onto. |
string | $origin | The request's Origin header. |
boolean | $isSsl | Whether or not the request was over SSL. |
build() : \Psr\Http\Message\MessageInterface
Apply the queued headers to the response.
If the builder has no Origin, or if there are no allowed domains, or if the allowed domains do not match the Origin header no headers will be applied.
A new instance of the response with new headers.
allowOrigin(string|array $domain) : $this
Set the list of allowed domains.
Accepts a string or an array of domains that have CORS enabled.
You can use *.example.com
wildcards to accept subdomains, or *
to allow all domains
string|array | $domain | The allowed domains |
Loading…