From b5db832f46328dac4fe17f873e20f204d70bfdb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Arranz?= Date: Wed, 10 May 2017 16:30:08 +0200 Subject: [PATCH] Upload missing changes for supporting CORS. See #2 --- logic.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/logic.js b/logic.js index a1888c9..e52ed08 100644 --- a/logic.js +++ b/logic.js @@ -99,6 +99,19 @@ exports.options_eventsource = function options_eventsource(req, res) { if (origin != null) { res.header('Access-Control-Allow-Origin', origin); res.header('Access-Control-Allow-Methods', 'POST, OPTIONS'); + res.header('Access-Control-Allow-Headers', 'X-Requested-With'); + res.header('Access-Control-Expose-Headers', 'Location'); + } + res.send(204); +}; + +exports.options_eventsource_entry = function options_eventsource_entry(req, res) { + res.header('Connection', 'keep-alive'); + var origin = req.header('Origin'); + if (origin != null) { + res.header('Access-Control-Allow-Origin', origin); + res.header('Access-Control-Allow-Methods', 'GET, DELETE'); + res.header('Access-Control-Allow-Headers', 'X-Requested-With'); } res.send(204); };