Need help with CORS and ionic 2


#1

I read all the suggestions and also followed the ionic suggestion how to overcome the CORS issue and get rid of the error: “Access-Control-Allow-Origin” with no success. I think I am missing the exact path conversion in proxies:

The url I am trying to access in firebase is: https://firebasestorage.googleapis.com/v0/b/Test1-xxxxx.appspot.com/o/userData.

My local host is: localhost:8100.

I don’t understand how should I edit the path and proxyUrl in ionic.config.json:

{

“name”: “Test1”, “app_id”: “”, “v2”: true, “typescript”: true,

“proxies”: [{
“path”: “…”,

“proxyUrl”: “…”

}]}

code looks like this:
firebase_storage_Ref.child(path/title).getDownloadURL().then(function(url) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var response = xmlhttp.responseText; // should have text here with no success
}
};
xmlhttp.open(“GET”, url, true);
xmlhttp.send();

I have tried many ways with no success, I am probably missing the point. I am new to Apps in general. I am starting with Web app using angular2+Ionic2 Thanks for any help.


#2

Follow this answer, check whether this work for you or not.


#3

Thanks for your answer, I was able to get my data with proxies settings according to help I got from Volodymyr Bilyachat on stackoverflow. Here is the solution that helped me: