2 posts / 0 new
Last post
Last seen: 4 months 1 week ago
Joined: October 28, 2016
Hitting "CORS wall" when trying to GET data from API


I hope someone could help me with the issue i have. I'm making an app that shows customer some products that  are currently on sale.

I've tested the whole thing using pure python on my dev computer and using postman. Trouble is, when i try to use the the JS code in the desired "webpage" i get "No access control allow origin-header" error. 

I could't figure this one out, so i thode that i make custom python box that then forwards the data to browser using ALMemory. Though luck, but trying to do the requests throws out error of SSL.

Any ideas how i could make this work?

Last seen: 10 hours 15 min ago
Joined: March 5, 2017

Try adding proxy url , found this at https://stackoverflow.com/questions/43871637/no-access-control-allow-ori...


const proxyurl = "https://cors-anywhere.herokuapp.com/";
const url = "https://example.com"; // site that doesn’t send Access-Control-*
fetch(proxyurl + url) // https://cors-anywhere.herokuapp.com/https://example.com
.then(response => response.text())
.then(contents => console.log(contents))
.catch(console.log("Can’t access " + url + " response. Blocked by browser?"))