Getting blocked by CORS testing ios app

Added some ionic/cordova functionality to the app. Did a build to android and works fine.
On apple, it builds fine, and it pushes the app to the phone. I can’t login.

Open up Safari to debug and in the console log it says.
Failed to load resource: Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin. then the dev service I had the code point to.

Is ios trying to run this as a server and not as a file?
Not sure why I didn’t have this problem on android.
Any idea how to fix?

So from the sounds of this, you might be hitting a WKWebview issue.

WKWebview enforces CORS and does not provide a way to bypass it. Meaning that what ever API you’re making a request to needs to implement CORs correctly. The WKWebview docs go over this in more detail and link to some MDN resources

Yeah that does look like that is my problem.

I guess I’m just dumb to all of this, but the fix is to add
"Origin: http://localhost:8080"
I’m not sure where I’m adding that. Am I adding that to my server (jboss), to the web service requests, or to something I’m sending out?

You must to configure your server to allow cross domains. Take a look at the internet what do that with your current server.

I added the cors stuff for TomCat
https://tomcat.apache.org/tomcat-7.0-doc/config/filter.html

I can login, but after we login the next web service call is blocked.

I posted my question here.

I don’t know why I get past cors for the first login call, but not the second???