I have a capacitor app which works fine for Android, and for iOS, it’s a little different:
I use vue-cli-plugin-capacitor to run in the development mode, which will set the server://xxx.xxx.xxx.xxx:8080 in the capacitor.config.json, it works.
The problem occurs in the release mode. When I package the app using Xcode and run, the app is running, but some call to the remote server is reject because of CORS restriction:
The request send out from capacitor is:
Content-Type: application/json;charset=UTF-8
Origin: capacitor://localhost
Accept: /
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
X-SDK-Version: @cloudbase/js-sdk/1.4.0
x-seqid: ec0772ba0a37d
As I cannot config the allowed Origin start from capacitor://, how to change this origin value to http://localhost?