# Ionic3 - Cross origin requests are only supported for HTTP

**URL:** <https://forum.ionicframework.com/t/ionic3-cross-origin-requests-are-only-supported-for-http/155624>\
**Category:** ionic-v3\
**Created:** [February 7, 2019, 12:02pm UTC](https://forum.ionicframework.com/t/ionic3-cross-origin-requests-are-only-supported-for-http/155624 "2019-02-07T12:02:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoseGonzaga](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/josegonzaga/32/125251_2.png) [@JoseGonzaga](https://forum.ionicframework.com/u/JoseGonzaga)\
**Post date:** [February 7, 2019, 12:02pm UTC](https://forum.ionicframework.com/t/ionic3-cross-origin-requests-are-only-supported-for-http/155624/1 "2019-02-07T12:02:48Z")

</div>

Create an application with back-end spring-rest and front-end with Ionic3. It’s working locally. So I put the backend on the Amazon ec2. I am getting access to end-points through Postman or the browser itself, but I can not access through the front-end. It returns the following information: “Cross origin requests are only supported for HTTP.” and a second information “[Error] XMLHttpRequest can not load [ec2-52-67-72-74.sa-east-1.compute.amazonaws.com:8080/login](http://ec2-52-67-72-74.sa-east-1.compute.amazonaws.com:8080/login) due to access control checks.”. How can I resolve this? thanks.

---

<div class="post-metadata">

**Author:** ![MaBbKhawaja](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mabbkhawaja/32/120141_2.png) [@MaBbKhawaja](https://forum.ionicframework.com/u/MaBbKhawaja)\
**Post date:** [February 7, 2019, 12:18pm UTC](https://forum.ionicframework.com/t/ionic3-cross-origin-requests-are-only-supported-for-http/155624/2 "2019-02-07T12:18:16Z")

</div>

header(‘Access-Control-Allow-Origin: \*’);  
add this in your api

---

<div class="post-metadata">

**Author:** ![JoseGonzaga](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/josegonzaga/32/125251_2.png) [@JoseGonzaga](https://forum.ionicframework.com/u/JoseGonzaga)\
**Post date:** [February 7, 2019, 2:27pm UTC](https://forum.ionicframework.com/t/ionic3-cross-origin-requests-are-only-supported-for-http/155624/3 "2019-02-07T14:27:56Z")

</div>

Hi, I already did this action, I can actually run the endpoint through the browser or Postman, only in the app that brings this error. “Cross origin requests are only supported for HTTP.” For exemple, this link run fine.  
“XMLHttpRequest cannot load [ec2-52-67-74-76.sa-east-1.compute.amazonaws.com:8080/login](http://ec2-52-67-74-76.sa-east-1.compute.amazonaws.com:8080/login) due to access control checks.”

---

<div class="post-metadata">

**Author:** ![FdezRomero](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/fdezromero/32/110635_2.png) [@FdezRomero](https://forum.ionicframework.com/u/FdezRomero)\
**Post date:** [February 8, 2019, 1:21pm UTC](https://forum.ionicframework.com/t/ionic3-cross-origin-requests-are-only-supported-for-http/155624/4 "2019-02-08T13:21:40Z")

</div>

Check this article, it may help you find what’s happening: [CORS Errors in Ionic Apps](https://fdezromero.com/cors-errors-in-ionic-apps/).

Also, what origin is your app running from?

Best,  
Rodrigo

---

<div class="post-metadata">

**Author:** ![JoseGonzaga](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/josegonzaga/32/125251_2.png) [@JoseGonzaga](https://forum.ionicframework.com/u/JoseGonzaga)\
**Post date:** [April 15, 2019, 10:33am UTC](https://forum.ionicframework.com/t/ionic3-cross-origin-requests-are-only-supported-for-http/155624/5 "2019-04-15T10:33:27Z")

</div>

> [@FdezRomero](#):
>
> CORS Errors in Ionic Apps

Hello, I made the correction, in fact the error was in the URL, I had not informed the http: // at the beginning. Great article, quite enlightening. Thank you.

---

<div class="post-metadata">

**Author:** ![ranjithreddy](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@ranjithreddy](https://forum.ionicframework.com/u/ranjithreddy)\
**Post date:** [April 15, 2019, 11:56am UTC](https://forum.ionicframework.com/t/ionic3-cross-origin-requests-are-only-supported-for-http/155624/6 "2019-04-15T11:56:36Z")

</div>

if you using ionic 4 , use ionic-native HTTP plugin.it allow cross-origin but you need to run your app in device,other wise handle through your back end code.
