Hey,
I have an issue that headers are not in my response. Everything working fine on default netlify domain
(https://hungry-mcnulty-330bd5.netlify.app/) but on my custom domain ( kurierapka.pl) I cant make any request to my server ( https://murmuring-hollows-26750.herokuapp.com/api/ )
My custom domain has configure DNS on netlify
Thats my cors options and headers.
const corsOptions = {
// origin: process.env.ORIGIN_URL
origin: [
'https://hungry-mcnulty-330bd5.netlify.app',
'https://kurierapka.pl',
'http://localhost:4200'
],
credentials: true
};
app.use(cors(corsOptions));
app.use(function(req, res, next) {
res.setHeader("Access-Control-Allow-Origin", "*"); // update to match the domain you will make the request from
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
res.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With, Content-Type, Authorization, Content-Length, X-Api-Key');
res.header('Access-Control-Allow-Credentials', 'true');
next();
});