I’m playing around with React Native using the Expo toolkit. I use fetch to get a tiny html page from Node.js running on my machine. The protocol I use is http not https because I don’t have a signed certificate. When I run this in a browser it works, but when I run it on my iPhone (XR) it gives me TypeError: network request failed.
I know that I must have the key NSAllowsArbitraryLoads set to true in my Info.plist and so I have that. I’ve also tried inserting a key with my pc’s (local) IP adress in the NSExceptionDomains dictionary with the NSExceptionAllowsInsecureHTTPLoads set to true, but without success (likewise with NSTemporaryExceptionAllowsInsecureHTTPLoads).
The server includes the headers Access-Control-Allow-Origin and Access-Control-Allow-Headers (value “*”) and I’ve searched the drive from my app’s directory down to see if perhaps there are more Info.plist files and I’m editing the wrong one, but that does not appear to be the case. I’ve switched off my firewall entirely (I’m on Windows 10).
When using https and a self-signed certificate the behaviour is identical (ie, works in the browser, network request failed on the iPhone). But when I upload the Node.js server to Azure and run it from there using https with the signed certificate that Azure supplies, the error is gone and the app does the same thing on my iPhone as in the browser.
Any suggestions what to look for?