Browse Source

fix-cors-allow-origin-star

master
Serge Shutov 2 weeks ago
parent
commit
9a2a2dcce2
  1. 4
      bridge/server.js

4
bridge/server.js

@ -71,7 +71,7 @@ function sendJson(res, status, obj) {
const body = JSON.stringify(obj); const body = JSON.stringify(obj);
res.writeHead(status, { res.writeHead(status, {
'Content-Type': 'application/json; charset=utf-8', 'Content-Type': 'application/json; charset=utf-8',
'Access-Control-Allow-Origin': 'http://127.0.0.1:8766', 'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Content-Type, Authorization', 'Access-Control-Allow-Headers': 'Content-Type, Authorization',
'Access-Control-Allow-Methods': 'GET, POST, PUT, OPTIONS', 'Access-Control-Allow-Methods': 'GET, POST, PUT, OPTIONS',
}); });
@ -259,7 +259,7 @@ const server = http.createServer(async (req, res) => {
if (req.method === 'OPTIONS') { if (req.method === 'OPTIONS') {
res.writeHead(204, { res.writeHead(204, {
'Access-Control-Allow-Origin': 'http://127.0.0.1:8766', 'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Content-Type, Authorization', 'Access-Control-Allow-Headers': 'Content-Type, Authorization',
'Access-Control-Allow-Methods': 'GET, POST, PUT, OPTIONS', 'Access-Control-Allow-Methods': 'GET, POST, PUT, OPTIONS',
}); });

Loading…
Cancel
Save