Set the response Access-Control-Allow-Headers header correctly for OPTIONS requests (#534)
This commit is contained in:
parent
857cacfda7
commit
3a10db99c7
|
@ -660,8 +660,11 @@ void HttpControllersRouter::doPreHandlingAdvices(
|
|||
resp->addHeader("Access-Control-Allow-Origin", origin);
|
||||
}
|
||||
resp->addHeader("Access-Control-Allow-Methods", methods);
|
||||
resp->addHeader("Access-Control-Allow-Headers",
|
||||
"x-requested-with,content-type");
|
||||
auto &headers = req->getHeaderBy("access-control-request-headers");
|
||||
if (!headers.empty())
|
||||
{
|
||||
resp->addHeader("Access-Control-Allow-Headers", headers);
|
||||
}
|
||||
callback(resp);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -337,8 +337,11 @@ void HttpSimpleControllersRouter::doPreHandlingAdvices(
|
|||
resp->addHeader("Access-Control-Allow-Origin", origin);
|
||||
}
|
||||
resp->addHeader("Access-Control-Allow-Methods", methods);
|
||||
resp->addHeader("Access-Control-Allow-Headers",
|
||||
"x-requested-with,content-type");
|
||||
auto &headers = req->getHeaderBy("access-control-request-headers");
|
||||
if (!headers.empty())
|
||||
{
|
||||
resp->addHeader("Access-Control-Allow-Headers", headers);
|
||||
}
|
||||
callback(resp);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -282,8 +282,11 @@ void WebsocketControllersRouter::doControllerHandler(
|
|||
resp->addHeader("Access-Control-Allow-Origin", origin);
|
||||
}
|
||||
resp->addHeader("Access-Control-Allow-Methods", methods);
|
||||
resp->addHeader("Access-Control-Allow-Headers",
|
||||
"x-requested-with,content-type");
|
||||
auto &headers = req->getHeaderBy("access-control-request-headers");
|
||||
if (!headers.empty())
|
||||
{
|
||||
resp->addHeader("Access-Control-Allow-Headers", headers);
|
||||
}
|
||||
callback(resp);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue