# Ionic CORS problem

**URL:** <https://forum.ionicframework.com/t/ionic-cors-problem/26463>\
**Category:** ionic-v1\
**Created:** [June 16, 2015, 7:24am UTC](https://forum.ionicframework.com/t/ionic-cors-problem/26463 "2015-06-16T07:24:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bilalbayasut](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bilalbayasut/32/87295_2.png) [@bilalbayasut](https://forum.ionicframework.com/u/bilalbayasut)\
**Post date:** [June 16, 2015, 7:24am UTC](https://forum.ionicframework.com/t/ionic-cors-problem/26463/1 "2015-06-16T07:24:56Z")

</div>

Hi, I tried to access the api on my server, but when I debug it through the browser or run it through ionic view, the error appears like this:

XMLHttpRequest cannot load http:/apiserver/api/. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘[http://localhost](http://localhost)’ is therefore not allowed access.

I have found a tutorial here [http://blog.ionic.io/handling-cors-issues-in-ionic/](http://blog.ionic.io/handling-cors-issues-in-ionic/)

and i tried all of them, but still failed… any idea?

---

<div class="post-metadata">

**Author:** ![maxx0r](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/maxx0r/32/91299_2.png) [@maxx0r](https://forum.ionicframework.com/u/maxx0r)\
**Post date:** [June 16, 2015, 7:32am UTC](https://forum.ionicframework.com/t/ionic-cors-problem/26463/2 "2015-06-16T07:32:40Z")

</div>

Did you try to set the right headers for cors?

Access-Control-Allow-Origin: \*

see [http://enable-cors.org/server.html](http://enable-cors.org/server.html)

---

<div class="post-metadata">

**Author:** ![antoniocxv](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@antoniocxv](https://forum.ionicframework.com/u/antoniocxv)\
**Post date:** [June 16, 2015, 7:50am UTC](https://forum.ionicframework.com/t/ionic-cors-problem/26463/3 "2015-06-16T07:50:20Z")

</div>

If you are working with Chrome install this component:

> **[Allow-Control-Allow-Origin: \*](https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi)**
>
> Allows to you request any site with ajax from any source. Adds to response 'Allow-Control-Allow-Origin: \*' header

that fixed the problem. Although you have to install in your computer, in android it will work fine.

---

<div class="post-metadata">

**Author:** ![bilalbayasut](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bilalbayasut/32/87295_2.png) [@bilalbayasut](https://forum.ionicframework.com/u/bilalbayasut)\
**Post date:** [June 16, 2015, 7:52am UTC](https://forum.ionicframework.com/t/ionic-cors-problem/26463/4 "2015-06-16T07:52:07Z")

</div>

well, when I deploy to the ionic view, it still can’t access the api… in this case I access my login api, and still can’t access it

---

<div class="post-metadata">

**Author:** ![antoniocxv](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@antoniocxv](https://forum.ionicframework.com/u/antoniocxv)\
**Post date:** [June 16, 2015, 7:57am UTC](https://forum.ionicframework.com/t/ionic-cors-problem/26463/5 "2015-06-16T07:57:11Z")

</div>

have you tried with CORS for chrome?

 ![image](https://global.discourse-cdn.com/ionicframework/original/2X/e/e5e533ce0cdcc02d0a05fcaa834ba33e6e5a92ae.png)

I dont understand your last post

---

<div class="post-metadata">

**Author:** ![bilalbayasut](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bilalbayasut/32/87295_2.png) [@bilalbayasut](https://forum.ionicframework.com/u/bilalbayasut)\
**Post date:** [June 16, 2015, 8:33am UTC](https://forum.ionicframework.com/t/ionic-cors-problem/26463/6 "2015-06-16T08:33:20Z")

</div>

> [@bilalbayasut](#):
>
> the ionic view, it still can’t access the api… in this case I access my login ap

I tried, but if in the chrome succeed , it is only used in development. do you know ionic view? Ionic android apps that let us deploy our ionic to the client app without installing the apk over and over again. Well by using that ionic view, my app still can’t access the api in the server
