mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
修复跨域问题: #2548
This commit is contained in:
parent
72ba87c803
commit
ccddb84a19
@ -594,6 +594,13 @@ void HttpSession::sendResponse(int code,
|
|||||||
headerOut.emplace("Date", dateStr());
|
headerOut.emplace("Date", dateStr());
|
||||||
headerOut.emplace("Server", kServerName);
|
headerOut.emplace("Server", kServerName);
|
||||||
headerOut.emplace("Connection", bClose ? "close" : "keep-alive");
|
headerOut.emplace("Connection", bClose ? "close" : "keep-alive");
|
||||||
|
|
||||||
|
GET_CONFIG(bool, allow_cross_domains, Http::kAllowCrossDomains);
|
||||||
|
if (allow_cross_domains) {
|
||||||
|
headerOut.emplace("Access-Control-Allow-Origin", "*");
|
||||||
|
headerOut.emplace("Access-Control-Allow-Credentials", "true");
|
||||||
|
}
|
||||||
|
|
||||||
if (!bClose) {
|
if (!bClose) {
|
||||||
string keepAliveString = "timeout=";
|
string keepAliveString = "timeout=";
|
||||||
keepAliveString += to_string(keepAliveSec);
|
keepAliveString += to_string(keepAliveSec);
|
||||||
|
Loading…
Reference in New Issue
Block a user