Issue
I experience the following situation:
Having an HTTP server written in Go
using Gin
framework and hosted on AWS
, only some people (approximately 20%
) are able to connect (everyone is connecting from a React Native
axios
client using an Android
device).
The server is located on ec2-3-131-85-255.us-east-2.compute.amazonaws.com:2302
. Every request is POST
. For example, to register, users access the /register
endpoint, http://ec2-3-131-85-255.us-east-2.compute.amazonaws.com:2302/register
.
Any hint would be helpful. Thank you in advance.
Solution
Most of Android devices doesn't accept http protocol by default so you have to add https
and add this in your manifest application tag
android:networkSecurityConfig="@xml/network_security_config
and add this file to your android
res/xml/network_security_config
and write this inside this file
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">Your URL</domain>
</domain-config>
<base-config cleartextTrafficPermitted="false"/>
</network-security-config>
Answered By - Ahmed Jamal