How can I set options in the fetch
method of react-native to make a call to a webserver go through a proxy.
Currently I am using axios but this doesn't work.
After adding a host header to the fetch, I can make a request through charles-proxy but it doesn't work with squid. (Error: invalid url
).
You can solve this by installing local-cors-proxy
globally and run it by
npm install -g local-cors-proxy
Start Proxy:
lcp --proxyUrl https://www.yourdomain.ie
Then in your client code, new API endpoint:
http://localhost:8010/proxy/movies/list
Package: https://www.npmjs.com/package/local-cors-proxy
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