Hi everyone,
During the development the application mobile using Ionic Capacitor version 6, I had the problem of CORS (Cross-Origin Resource Sharing) that happened only with Iphone (the Android app works well).
According to the article that I found from ionic.io: Handling CORS issues in Ionic - Ionic Blog, when we run the app the phone, the orgin will not exist, therefore, any request outwards will not require a CORS request.
I verify the Http.Request.Headers and found that the orgin is capacitor://localhost (not file://some/path/www/index.html) like the above article mentioned.
So, my question is how could I run my app in Iphone that will use file://some/path/www/index.html instead of capacitor://localhost to avoid the CORS error in Ios.
Regards,
Vu Pham
Information about my application:
API Server: WCF (Windows Communication Foundation)
Enabling CORS in WCF: Enabling CORS in WCF
My app information:
“dependencies”: {
“@angular/common”: “^14.2.4”,
“@angular/core”: “^14.2.4”,
“@angular/forms”: “^14.2.4”,
“@angular/platform-browser”: “^14.2.4”,
“@angular/platform-browser-dynamic”: “^14.2.4”,
“@angular/router”: “^14.2.4”,
“@capacitor/android”: “4.3.0”,
“@capacitor/app”: “4.0.1”,
“@capacitor/core”: “4.3.0”,
“@capacitor/device”: “^4.0.1”,
“@capacitor/haptics”: “4.0.1”,
“@capacitor/ios”: “4.3.0”,
“@capacitor/keyboard”: “4.0.1”,
“@capacitor/preferences”: “^4.0.1”,
“@capacitor/push-notifications”: “^4.1.2”,
“@capacitor/splash-screen”: “^4.1.3”,
“@capacitor/status-bar”: “4.0.1”,
“@ionic/angular”: “^6.2.9”,
“@ionic/storage-angular”: “^3.0.6”,
“@ngx-translate/core”: “^14.0.0”,
“@ngx-translate/http-loader”: “^7.0.0”,
“ionicons”: “^6.0.3”,
“rxjs”: “~7.5.7”,
“tslib”: “^2.4.0”,
“uuid”: “^9.0.0”,
“zone.js”: “~0.11.8”
}