Closed juanzitelli closed 3 years ago
https://codesandbox.io/s/youthful-browser-mx5ix?file=/src/App.tsx Here's the example
Cannot access the codesandbox @juanzitelli :( ... you could try setting the Access-Control-Allow-Origin: *
header on the axios request though...
Sorry! I deleted it, I'll create a new one and try again! And I'll let you know if that solves the issue :)
Did you manage to fix it @juanzitelli ?
I'm trying to use this API to make a simple app in React and TS to show AOEII civilizations. For this purpose I'm using Axios to fetch data, but I can't make it work. I can fetch the data from Postman, Curl, Chrome (pasting the GET url in the search bar) and when I try to make a request from my CodeSandbox App, It throws a Network Error, addressing there's a CORS policy blocking my request, but then how am I capable of fetching that particular data from Chrome, Postman and Curl then? Postman doesn't help either by not telling me which headers it uses to send the request.
I'm getting a 502 Network Error that looks like this:
/s/youthful-browser-mx5ix?file=/src/App.tsx:307-319:1 Access to XMLHttpRequest at 'https://zqixi-lsp.sse.codesandbox.io/socket.io/?type=go-to-definition&EIO=3&transport=polling&t=NTzf459' from origin 'https://codesandbox.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.