test cross origin for websocket domain #4
@@ -46,11 +46,20 @@ const webServer = http
|
||||
if (assets[reqFileName] != undefined && assets[reqFileName] != null) {
|
||||
extension = reqFileName.split(".").pop();
|
||||
if (extension == "html" || extension == "html") {
|
||||
res.writeHead(200, { "Content-Type": "text/html" });
|
||||
res.writeHead(200, {
|
||||
"Content-Type": "text/html",
|
||||
"Access-Control-Allow-Origin": "https://" + config.webSocketDomain,
|
||||
});
|
||||
} else if (extension == "js") {
|
||||
res.writeHead(200, { "Content-Type": "text/javascript" });
|
||||
res.writeHead(200, {
|
||||
"Content-Type": "text/javascript",
|
||||
"Access-Control-Allow-Origin": "https://" + config.webSocketDomain,
|
||||
});
|
||||
} else {
|
||||
res.writeHead(200, { "Content-TYpe": "text/plain" });
|
||||
res.writeHead(200, {
|
||||
"Content-TYpe": "text/plain",
|
||||
"Access-Control-Allow-Origin": "https://" + config.webSocketDomain,
|
||||
});
|
||||
}
|
||||
res.end(assets[reqFileName]);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user