Open
Description
Hello,
I use the possibility to modify the Express server before starting it as described in https://github.com/holidayextras/jsonapi-server/blob/master/documentation/configuring.md#gaining-access-to-the-express-server
For example, I need cookie-authentication and have to add some headers:
const app = jsonApi.getExpressServer();
app.use(function(req, res, next) {
res.set('Access-Control-Allow-Origin', 'http://localhost:4200');
res.set('Access-Control-Allow-Credentials', 'true');
return next();
});
But the header Access-Control-Allow-Origin
gets overwritten during the initialization of the json api server:
Lines 23 to 30 in 368ad6b
I changed it locally, so that the header is only set, when it is not already present:
if (!res.get('Access-Control-Allow-Origin')) {
res.set('Access-Control-Allow-Origin', '*');
}
Should I prepare a pull request with this change? Or does this break something I am not aware of?
Cheers,
Friedrich
Metadata
Metadata
Assignees
Labels
No labels