CORS issue: Response to preflight request doesn't pass access control check: It does not have HTTP ok status

Hi,

I am trying to use the API to request data in a React web app (essentially Javascript run in browser). Unfortunately, this leads to a CORS error (Cross-Origin Resource Sharing):

Access to XMLHttpRequest at ‘https://www.renewables.ninja/api/data/pv’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: It does not have HTTP ok status.

Do you know a workaround?

A stackoverflow thread suggests this:

A way to handle these to get comfortable is to ensure that for any path with OPTIONS method the server sends a response with this header

Access-Control-Allow-Origin: *

Not sure whether it is an easy fix for you; here is a more detailed description:
https://enable-cors.org/server.html

Thanks,
Fabio