Background
All over the internet people are asking why they cant make http request in react native. The answer is commonly because they must update their exceptions in the info.plist
. For me this was an issue at one point at time. I updated my settings and http
in a fetch
request was working.
Since than I updated my server and have SSL
on my node api end points. When I hit the end points in post man on the production server there are no problems. But when I remove the settings I added to the info.plist
to allow http
request and then try to run my app I get the error again when running code that hits the end points using https
in the fetch call.
Code Example
I updated my code to make the request like this:
fetch('https://api.email.com/v1/clients/update', {
...
}
When making request with http like this:
fetch('http://api.email.com/v1/clients/update', {
...
}
I used this in the info.plist
<key>api.wuno.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>wuno.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
But now I once again get the error:
Network Request Failed
Question
Now that I have SSL
on the API
end points. It is working when hit with postman. I removed the exceptions from info.plist
.
What steps do I need to take to make https
work with fetch
for my react native
app?