In an express app there is a middleware setting the headers like this
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*')
res.header('Access-Control-Allow-Headers', [
'Accept',
'Authorization',
'Content-Type',
'Origin',
'X-Requested-With'
].join(', '))
res.header('Access-Control-Allow-Methods', [
'DELETE',
'GET',
'HEAD',
'OPTIONS',
'PATCH',
'POST',
'PUT'
].join(', '))
next()
})
But when doing a request I still get an error
No 'Access-Control-Allow-Origin' header is present on the requested resource.