CORS issues after adding Ionic Pro to the project

Hi everyone,

We’ve noticed that ever since adding the Ionic Pro dependencies to our project, we started running into CORS issues while running on a real device. Our app relies heavily on interactions with an API that doesn’t have CORS enabled, neither can it have it enabled.

We’ve noticed that ever since adding the library, our requests origins changed from file:// to http://localhost:8080 - presumably because of Ionic Deploy? With the file origin everything works fine, however with the localhost origin none of our requests work.

So our questions are:

  • has anyone come across this?
  • am I right to assume that the origin changed because of Ionic Pro, more specifically Ionic Deploy?
  • is there any way to keep a file:// origin while using Ionic Monitoring? We don’t really care about Deploy at this stage.

Thanks,
Seb

That’s because if I’m not mistaken you’re using WKWebView.

This is a very handly library that solves everything for you, just follow his installation guide.

If you want other way to solve this, the only way is using HTTP Native, which I don’t recommend,

Or also you can downgrade to UIWebView which is the worst you could do since iOS is going to deprecate it really soon

Thanks for your quick response. I should have mentioned, we’re using Android.

Hi, doesn’t matter what you’re using since I think that WKWebView is a required dependency for Ionic Pro. The easiest and best thing you could do is install the library I referenced.

Thanks Kyrax. Definitely worth a go - I’ll integrate the library later today and let you know how it went.