When I send an ajax request, it works fine in the browser but returns an internal error when sent within a Cordova APK. Upon comparing the headers, I noticed that the only difference is in the ORIGIN:
The one not working has origin: file://
POST 500 (Internal Server Error)
Accept: application/json, text/javascript, */*; q =0.01
Accept-Encoding: gzip, deflate
Accept-Language: en-US
Connection: keep-alive
Content-Length: 59
Content-Type: application/json
Cookie: saplb_*=(J2EE9465620)9465650
Host: -------
Origin: file://
User-Agent: Mozilla/5.0 (Linux; Android 7.0; Android SDK built for x86 Build/NYC; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/51.0.2704.90 Mobile Safari/537.36
X-DevTools-Emulate-Network-Conditions-Client-Id: 364FC1A3-AE91-465B-821A-9EA13D731E5E
X-Requested-With: io.cordova.hellocordova