Reputation: 874
The ReactNative's fetch
method causes Network Request Failed
error in requesting API URL or any other resources from jordanpizza.ir.
I made a fork(https://codesandbox.io/s/5vwyq4wmnp) of react-native-web project's sandbox with this addition code at App.js:
componentDidMount() {
fetch("https://jordanpizza.ir/test.json").then(response => {
console.log(response);
});
}
This sandbox reproduces my problem.
Note: All resources are accessible from Postman or direct request in browser.
Upvotes: 0
Views: 592
Reputation: 874
The problem had two aspects:
CORS error that solved by the @mikheevm solution.
DDoS protection on layer 7 provided by ArvanCloud. It blocked our requests and caused 307 redirections to be repeated, which ended when the request was canceled. This problem was also solved by clinging to the basic protection.
Upvotes: 0