Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
configureAllowedOrigin example
public
function
handlePreflightRequest
(
Request
$request
)
: Response
{
$response
=
new
Response
(
)
;
$response
->
setStatusCode
(
204
)
;
return
$this
->
addPreflightRequestHeaders
(
$response
,
$request
)
;
}
public
function
addPreflightRequestHeaders
(
Response
$response
, Request
$request
)
: Response
{
$this
->
configureAllowedOrigin
(
$response
,
$request
)
;
if
(
$response
->headers->
has
(
'Access-Control-Allow-Origin'
)
)
{
$this
->
configureAllowCredentials
(
$response
,
$request
)
;
$this
->
configureAllowedMethods
(
$response
,
$request
)
;
$this
->
configureAllowedHeaders
(
$response
,
$request
)
;
$this
->
configureMaxAge
(
$response
,
$request
)
;
}