I am using React on the front-end and I'm calling API from another domain which I don't own. My axios request:
axios(requestURL, {
method: 'GET',
headers: {
'Access-Control-Allow-Origin': '*',
'Content-Type': 'application/json',
'Authorization': key,
withCredentials: true,
mode: 'no-cors',
}
I keep on getting the same error: CORS header ‘Access-Control-Allow-Origin’ missing. Is this something I can overcome from the frontend? I know for a fact that people use that API so it can't be backend fault, right? I tried requesting a lot of APIs and not even one worked with my code. I tried using https://cors-anywhere.herokuapp.com and it worked fine for like a week, I think its down today. I want my site to stay 24/7 so using a proxy is not an option
One can use CORS-anywhere. It is a NodeJS reverse proxy which adds CORS headers to the proxied request.
If I want to add CORS to https://test-example.com, then I'd just do it as follows:
https://cors-anywhere-herokuapp.com/https://test-example.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With