kovacs-tamas commented on issue #43: Network Error cordova [email protected][bug] URL: https://github.com/apache/cordova-plugin-whitelist/issues/43#issuecomment-539520311 I have the also issues. I always get the following error message when i want to connect to a server: ``` XMLHttpRequest cannot load https://staging-server.****.com/version. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. ``` I've never saw OPTIONS request before, no errors or warning in Monitor. ```bash Ionic: ionic (Ionic CLI) : 4.5.0 (/usr/local/lib/node_modules/ionic) Ionic Framework : ionic1 1.3.3 @ionic/v1-toolkit : 2.0.11 Cordova: cordova (Cordova CLI) : 9.0.0 ([email protected]) Cordova Platforms : android 8.1.0 Cordova Plugins : no whitelisted plugins (29 plugins total) System: Android SDK Tools : 26.1.1 (/Users/tamas/Library/Android/sdk/) ios-deploy : 1.9.2 ios-sim : 8.0.2 NodeJS : v10.15.3 (/usr/local/lib/node_modules/node/bin/node) npm : 2.15.12 OS : macOS Xcode : Xcode 11.0 Build version 11A420a ``` My network_security_config: ```xml <?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="true">127.0.0.1</domain> <domain includeSubdomains="true">******.com</domain> <domain includeSubdomains="true">">******.com</domain> <domain includeSubdomains="true">staging-server-******.com</domain> <domain includeSubdomains="true">server.****.com</domain> </domain-config> </network-security-config> ``` Config.xml parts: ```xml <access origin="*" /> <allow-intent href="*" /> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <allow-intent href="tel:*" /> <allow-intent href="sms:*" /> <allow-intent href="mailto:*" /> <allow-intent href="geo:*" /> <allow-navigation href="*" /> <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android"> <application android:networkSecurityConfig="@xml/network_security_config" /> <application android:usesCleartextTraffic="true" /> </edit-config> <resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" /> ``` The generated Manifest.xml contains the needed parts: ```xml <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_security_config" android:supportsRtl="true" android:usesCleartextTraffic="true"> ``` I've tried with Crosswalk and IonicWebview also, i use the latest version: **1.3.4** The strange thing, i've tried a workaround, when i always return true in the WhitelistPlugin.java, but the problem still exists ```java @Override public Boolean shouldAllowRequest(String url) { return true; // if (Boolean.TRUE == shouldAllowNavigation(url)) { // return true; // } // if (allowedRequests.isUrlWhiteListed(url)) { // return true; // } // return null; // Default policy } ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
