Skip to content

Commit c3bcde7

Browse files
author
berkelium
committed
nui: add CORS whitelisting to RPCSchemeHandler
1 parent ab471c9 commit c3bcde7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

code/components/nui-resources/src/RPCSchemeHandler.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,10 @@ class RPCResourceHandler : public CefResourceHandler
158158
CefResponse::HeaderMap map;
159159
response->GetHeaderMap(map);
160160

161-
map.insert(std::make_pair("cache-control", "no-cache, must-revalidate"));
161+
map.insert({ "cache-control", "no-cache, must-revalidate" });
162+
map.insert({ "access-control-allow-origin", "*" });
163+
map.insert({ "access-control-allow-methods", "POST, GET, OPTIONS" });
164+
162165
response->SetHeaderMap(map);
163166

164167
if (m_found)
@@ -212,4 +215,4 @@ static InitFunction initFunction([] ()
212215
handler = new RPCResourceHandler();
213216
}
214217
});
215-
});
218+
});

0 commit comments

Comments
 (0)