I’ve been struggling to correctly configure CORS with my Play server for an Ionic app. When I run my app on an iOS device or simulator, I get “preflight response is not successful” errors. However, Android and browser settings work fine (including Chrome, FF, Safari and IE).
I initially tried an “open” policy as below, but did not have any luck.
However I still get the preflight error as before, which leads me to believe I have not implemented CORS correctly in regards to the checklist.
Does this configuration correctly address the CORS checklist from above? Has anyone deployed an Ionic app with a Play Framework backend that successfully handles CORS for WkWebview?
What headers are returned for the prefight request? Can you run a curl command to inspect that? The configuration looks correct, so it would be good to inspect the return and confirm the server is returning what you expect.
Many years ago play would disallow the file:// origin that Ionic sends and there was no way to properly configure it. The only solution was to disable play cors completely and do your own cors filter or cors route. This is what I did to avoid the problem during testing (app never made it to production):