I currently work on a React-Native mobile app.
The requests to the server API using fetch
works fine, but when I open the "Debug JS Remotely" with Google Chrome, it creates some kind of localhost server and the calls are made from it, and I get the following error from the server API:
XMLHttpRequest cannot load https://my.server.com/data. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8081' is therefore not allowed access.
It's pretty annoying not to be able to track the requests to the server in debug mode.
Any of you have faced a similar issue and do you have a way around it?
Thanks
I actually found a solution: I installed the Chrome extension Allow-Control-Allow-Origin:*
https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en
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