Description
Description
We have a backend that is connecting to a SOAP server and translating it to REST. The SOAP server can only be connected via VPN.
When running backend on local, API calls work fine both on Emulator and Android device.
But when we deployed the backend on a remote server, the Android device timeout (15 seconds) when trying to make a request.
Environment
npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.4 => 0.61.4 npmGlobalPackages: react-native-cli: 2.0.1
Expected Behavior
Axios resolves the post request without timing out.
Couple of suggested solutions online that I tried, and still got nothing working, were:
1. Create network_security_config.xml
and link it on AndroidManifest.xml
with android:networkSecurityConfig="@xml/network_security_config"
.
I also tried the solution below without the base-config
, having just domain-config
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">remove_server_ip_address_here</domain>
</domain-config>
</network-security-config>
2. Adding both android:usesCleartextTraffic="true"
tools:targetApi="28"
/tools:targetApi="29"
to application
tag in AndroidManifest.xml
. Also tried just adding android:usesCleartextTraffic="true"
without the tools:targetApi
3. Tried adding xmlns:tools="http://schemas.android.com/tools"
android:targetSandboxVersion="1"
to the root element of AndroidManifest.xml
Keep in mind I do have both <uses-permission android:name="android.permission.INTERNET" />
and <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
in my AndroidManifest.xml
Again the request only timeout when trying to post to remote server on an IP address, and it only doesnt work on Android device, everything works fine on Emulator.
Please help, Im not sure what to try anymore!