From 2cb41dd8cda53dd4d74c7b260d7324b0cbab247c Mon Sep 17 00:00:00 2001 From: Fabien O'Carroll Date: Mon, 22 Jul 2019 12:38:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20CORS=20for=20errors=20fr?= =?UTF-8?q?om=20Content=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #10932 Previously we were only applying the cors middleware to the options preflight request, which meant that if the request errored, the cors headers would not be applied, resulting in the client being unable to read response data. This applies the cors middleware to _all_ requests to the Content API. --- config.development.json | 6 +++++- core/server/web/api/v2/content/routes.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config.development.json b/config.development.json index 829a57ef53..7bad04ec4b 100644 --- a/config.development.json +++ b/config.development.json @@ -1,3 +1,7 @@ { - "enableDeveloperExperiments": true + "enableDeveloperExperiments": true, + "url": "http://site.egg", + "admin": { + "url": "http://site.ghost.egg" + } } diff --git a/core/server/web/api/v2/content/routes.js b/core/server/web/api/v2/content/routes.js index 07527a4a2f..ff37e4f8c3 100644 --- a/core/server/web/api/v2/content/routes.js +++ b/core/server/web/api/v2/content/routes.js @@ -6,7 +6,7 @@ const mw = require('./middleware'); module.exports = function apiRoutes() { const router = express.Router(); - router.options('*', cors()); + router.use(cors()); const http = apiv2.http;