add 'CORS' header to server responses

This commit is contained in:
Daniel Sommer 2022-02-11 21:02:45 +01:00
parent 0a74b8bbcc
commit 505400d1f4

View file

@ -78,6 +78,8 @@ function endRequest(request, response, msg, code) {
object.data = msg; object.data = msg;
} }
} }
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
response.writeHead(object.code); response.writeHead(object.code);
response.end(object.data); response.end(object.data);
logger.http(object); logger.http(object);