Axios timeout when posting to API on remote server (Only on Android device) #28739
Labels
Needs: Author Feedback
Needs: Environment Info
Please run `react-native info` and edit your issue with that command's output.
Newer Patch Available
Platform: Android
Android applications.
Platform: iOS
iOS applications.
Resolution: Locked
This issue was locked by the bot.
Type: Question
Issues that are actually questions and not bug reports.
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 onAndroidManifest.xml
withandroid:networkSecurityConfig="@xml/network_security_config"
.I also tried the solution below without the
base-config
, having justdomain-config
2. Adding both
android:usesCleartextTraffic="true"
tools:targetApi="28"
/tools:targetApi="29"
toapplication
tag inAndroidManifest.xml
. Also tried just addingandroid:usesCleartextTraffic="true"
without thetools:targetApi
3. Tried adding
xmlns:tools="http://schemas.android.com/tools"
android:targetSandboxVersion="1"
to the root element ofAndroidManifest.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 myAndroidManifest.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!
The text was updated successfully, but these errors were encountered: