CORS in Ionic View


#1

I am making a GET request in my app, and I understand the CORS issue when using ionic serve, but I think I am having the same issue when using Ionic View, I receive the error Response with status: 0 for URL: null

Do you think this is a CORS issue, and how do I make http requests in Ionic View?

Thanks


#2

Hi

Ionic View Pro has stricter handling of CORS (WKWebView), as compared to Ionic View legacy.

Your error makes me defintely think of CORS, which will be difficult to solve using the components you are using now, without chanigng the server endpoint.

Regards

Tom


#3

Thanks for the reply.
It’s a shame that Ionic View is strict with CORS, I can see that being an issue, it would be good to be able to use a potential client’s site to populate a sample app to show them.
You said “using the components you are using now”, do you have some components in mind that would make it easier?


#4

Hi

Well that would be things like building your own plugin, webview etc. So moving away from the ionic/angular layer. Not an obvious choice for me.

As to ionic view, it was recommended to me to raise a ticket @ ionic support so they can measure the communities’ need for different handling. This I did and maybe something others want to do too. @mattkremer

Regards

Tom


#5

You can also put a simple proxy backend app in between if this is a common thing for you.


#6

Thanks Tom, I’ll do that.


#7

Do you mean sending requests from the app to my own server, which in turn sends it to the actual end point I am after? Yes I had thought that might be an option, thanks.


#8

Exactly. If the data is public anyway, there are hosted proxies for that out there.