From 5e4d3dd22bc94602869f1f2f368b8e58b667d5b9 Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Sun, 14 Jan 2018 18:48:36 +0000 Subject: [PATCH] adding some cors to allow silvrtree to get the stuff --- server.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 54bbe95..3db40da 100644 --- a/server.js +++ b/server.js @@ -17,8 +17,10 @@ const cache = apicache.middleware; app.use(express.static(path.join(__dirname, sitePath))); app.all('/*', function(req, res, next) { - res.header("Access-Control-Allow-Origin", "*"); - res.header("Access-Control-Allow-Headers", "X-Requested-With"); + res.setHeader('Access-Control-Allow-Origin', '*'); + res.setHeader('Access-Control-Allow-Credentials', 'true'); + res.setHeader('Access-Control-Allow-Methods', 'GET,HEAD,OPTIONS,POST,PUT'); + res.setHeader('Access-Control-Allow-Headers', 'Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers'); next(); });