# HTTP Post requests failing on android, works as expected on ionic serve

**URL:** <https://forum.ionicframework.com/t/http-post-requests-failing-on-android-works-as-expected-on-ionic-serve/193820>\
**Category:** Ionic Framework\
**Created:** [August 3, 2020, 9:24am UTC](https://forum.ionicframework.com/t/http-post-requests-failing-on-android-works-as-expected-on-ionic-serve/193820 "2020-08-03T09:24:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![emandev1988](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/emandev1988/32/133338_2.png) [@emandev1988](https://forum.ionicframework.com/u/emandev1988)\
**Post date:** [August 3, 2020, 9:24am UTC](https://forum.ionicframework.com/t/http-post-requests-failing-on-android-works-as-expected-on-ionic-serve/193820/1 "2020-08-03T09:24:41Z")

</div>

Hi There

I am having a bit of an issue with regards to HTTP requests from my mobile app, when testing with ionic serve the app works perfectly and successfully sends HTTP posts to the server and receives data,  
however when running the app on android my HTTP posts fail with the following error -\> Http failure response for ionic.

Read a few forum responses and added the following code below hoping it would remedy my situation.

I’ve added the following code to my config.xml

```
 <application android:usesCleartextTraffic="true" />

```

and (code below) in network\_security\_config.xml

```
<domain-config cleartextTrafficPermitted="true">
    <domain includeSubdomains="true">localhost</domain>
    <domain includeSubdomains="true">172.20.175.8/</domain>
</domain-config>

```

I still get the same issue, cannot connect to the server and make HTTP posts.

Please could someone kindly assist me

---

<div class="post-metadata">

**Author:** ![mirkonasato](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mirkonasato/32/131398_2.png) [@mirkonasato](https://forum.ionicframework.com/u/mirkonasato)\
**Post date:** [August 3, 2020, 10:47am UTC](https://forum.ionicframework.com/t/http-post-requests-failing-on-android-works-as-expected-on-ionic-serve/193820/2 "2020-08-03T10:47:35Z")

</div>

> [@emandev1988](#):
>
> cannot connect to the server

What’s the URL? If you’re trying to connect to `localhost`, when your app is running on an Android device then `localhost` means the Android device itself, not your laptop or workstation.

---

<div class="post-metadata">

**Author:** ![emandev1988](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/emandev1988/32/133338_2.png) [@emandev1988](https://forum.ionicframework.com/u/emandev1988)\
**Post date:** [August 4, 2020, 8:30am UTC](https://forum.ionicframework.com/t/http-post-requests-failing-on-android-works-as-expected-on-ionic-serve/193820/3 "2020-08-04T08:30:07Z")

</div>

> [@emandev1988](#):
>
> ```auto
> <domain-config cleartextTrafficPermitted="true">
> <domain includeSubdomains="true">localhost</domain>
> <domain includeSubdomains="true">172.20.175.8/</domain>
> </domain-config>
> 
> ```

Hi, I seem to have figured it out, i had a slash in the 172.20.175.8/, I’ve removed it and now it is working.

Thank you
