From 4e29f4a807730178ec855bb8c19379a0a0c03c31 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 21 Jul 2022 18:07:07 +0300 Subject: [PATCH] Server: Add headers for path 'build-css', to avoid cross origin. --- server.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server.ts b/server.ts index ab6c9b4..3e0f2d3 100644 --- a/server.ts +++ b/server.ts @@ -87,6 +87,14 @@ export function app() { server.set('view engine', 'html'); server.set('views', distFolder); + server.use('/build-css', function (req, res, next) { + res.header('Access-Control-Allow-Origin', req.headers.origin); + res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); + res.header('Access-Control-Allow-Methods', 'GET, OPTIONS, POST, DELETE'); + res.header('Access-Control-Max-Age', "1800"); + next(); + }); + server.use(function (req, res, next) { var XFRAME_WHITELIST = [ 'http://spitoo.di.uoa.gr:5000/','http://scoobydoo.di.uoa.gr:5000/', 'https://beta.admin.connect.openaire.eu/','https://admin.connect.openaire.eu/' ]; let referer: string;