CORS problem with request randomly

I am getting this error with CORS using request:
Access to XMLHttpRequest at URL’ from origin ‘file://’ has been blocked by CORS policy: The ‘Access-Control-Allow-Origin’ header contains the invalid value ‘’.

It happens only when i run the apk on phone.
What i did:

  • enabled CORS on server, tested with curl
  • added “access origin=”*" " to config.xml
  • tested on android emulator, all fine (i guess my mobile webview sucks)

What can i do to fix this problem?
Thanks

AJAX не работает с локальными файлами. Работайте с Framework7 CLI: там поднимается веб-сервер и все работает отлично.

The ajax request is made to an external URL, not local, this problem happens only when i generate the APK on cordova.
The most strange thing is that randomly, when i close the app and open again, some requests work

Это связано с VkWebView. Тема много раз подымалась на форуме. Или ставить плагины, которые создадут сервер, или использовать CLI для сборки всех страниц в один файл.

I am using cli to generate the apk the create the single file, when i create the web app for production it works with no problem… it only happens when i generate the .apk file (Android case). Never heard about VkWebView, do you mean WkWebView? I read that it is used on iOS, but this problem is on Android.

Somehow this happens only on my phone that has a custom ROM… very strange behavior