I'm struggling to find a solution in order to have my React Native App (running in emulator) to connect via https to my local dev server.
The RN App connects using LAN Address (https://192.168.1.xxx)
It works connecting to my server in production.I need https connection on local dev server to test socket.io on websockets.
The server is made on top of next.js (Don't know if this may be relevant)
What I did:
- created self-signed certs for app and CA on dev server.
- installed the CA cert in the Android Emulator (Trusted Credentials-> User).
- checked that, once the certs were installed, chrome in the emulator correctly connects to the dev server without the usual Security Alert of "CERT_AUTHORITY_INVALID".
Problem:
When I run my react-native App in development (react-native start) it's not able to connect to server at all.
The fetch report as Exception:
TypeError: Network request failedLogCat does not report any meaningfull logs about the Error.On AndroidStudio -> view -> Tool Windows -> App Inspector -> Network Inspectorno connection attempt is logged at all.
All of this works correctly if I change https connection to http.
I read tons of articles/posts about react-native / Android / https but was not able to figure out a working solution for the issue without modifying the codebase:I would avoid to specialize my code only for testing/development case to ignore SSLVerification.
Any help is really appreciated.