🐛 Fixed CORS for errors from Content API

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.
This commit is contained in:
Fabien O'Carroll 2019-07-22 12:38:51 +08:00
parent 5da8da1879
commit 2cb41dd8cd
2 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,7 @@
{
"enableDeveloperExperiments": true
"enableDeveloperExperiments": true,
"url": "http://site.egg",
"admin": {
"url": "http://site.ghost.egg"
}
}

View File

@ -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;