mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +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("Server", kServerName);
|
||||
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) {
|
||||
string keepAliveString = "timeout=";
|
||||
keepAliveString += to_string(keepAliveSec);
|
||||
|
Loading…
Reference in New Issue
Block a user