[ https://issues.apache.org/jira/browse/CB-14124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16517042#comment-16517042 ]
jcesarmobile commented on CB-14124: ----------------------------------- Android uses file:// protocol so it's not affected by CORS, that doesn't mean your server is ok, just that Android ignores that problem. But the problem is definitely in your server. Also try changing header('Access-Control-Allow-Methods: *'); by replacing the * by actual methods like GET/POST > Access-Control-Allow-Headers > ---------------------------- > > Key: CB-14124 > URL: https://issues.apache.org/jira/browse/CB-14124 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-ios, cordova-plugin-wkwebview-engine > Affects Versions: cordova-ios@4.5.4, 8.0.0 > Reporter: Alejandro > Assignee: Suraj Pindoria > Priority: Major > Labels: CORS, WKWebView, ajax, cordova, cordova-8.0.0, > cordova-ios, ios > > Hello, > I have one app with: > Cordova version: 8.0.0 > cordova-ios version: 4.5.4 > I had to install the plugin > "[cordova-plugin-wkwebview-engine|https://github.com/apache/cordova-plugin-wkwebview-engine]" > to solve a problem with the interface. > In android everything works correctly. > But in IOS when I make AJAX requests to my API I have the error: > > XMLHttpRequest cannot load ....... Request header field Authorization is not > allowed by Access-Control-Allow-Headers > > In the API I have the following in place to allow CORS connections: > {code:java} > header('Access-Control-Allow-Headers: *'); > header('Access-Control-Allow-Origin: *'); > header('Access-Control-Allow-Methods: *'); > {code} > In the config.xml I have this: > {code:java} > <access origin="*" /> > <allow-intent href="http://*/*" /> > <allow-intent href="https://*/*" /> > <allow-intent href="tel:*" /> > <allow-intent href="sms:*" /> > <allow-intent href="mailto:*" /> > <allow-intent href="geo:*" /> > <feature name="CDVWKWebViewEngine"> > <param name="ios-package" value="CDVWKWebViewEngine" /> > </feature> > <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />{code} > and my AJAX requests are: > {code:java} > $.ajax({ > url: url, > data: formData, > type: 'post', > dataType: "json", > contentType: false, > processData: false, > success: function (respuesta) { > } > }); > {code} > And I have this meta: > {code:java} > <meta http-equiv="Content-Security-Policy" content="default-src * > gap:;font-src 'self' data:; style-src * 'unsafe-inline'; script-src * > 'unsafe-inline' 'unsafe-eval'; media-src *; img-src * filesystem: data:"> > {code} > The strange thing is that without the > plugin([cordova-plugin-wkwebview-engine|https://github.com/apache/cordova-plugin-wkwebview-engine]) > it works fine, but I need the plugin obligatorily. > I am desperate and I do not know what to do anymore. > any solution? -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org