I'm trying to get product information from the Bol.com open api (dutch webshop) through the following code.
const config = {
  mode: 'cors',
  headers: {
    'Access-Control-Allow-Origin':'*',
    'Access-Control-Allow-Methods': 'GET, POST, PATCH, PUT, DELETE, OPTIONS',
    'Access-Control-Allow-Headers': 'Origin, Content-Type, X-Auth-Token'
  }
};
axios.get(productUrl, config)
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });
When trying to run this code on my website or localhost I'm getting the following errors.
The link is correct (If I open the link in another tab I'm getting a json object with all the product data) so I think it's something with cors.
After seeing this post Response to preflight request doesn't pass access control check I turned off my CORS in Google Chrome and I was able to receive the requested data.
However I can't ask everybody to turn off cors so I would really like to know how I can solve this problem with code. Anyone can help me out?

