You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/02/24 09:08:56 UTC

[GitHub] [cordova-ios] iliyaST opened a new issue #1082: Cordova not allowing https cross origin requests.

iliyaST opened a new issue #1082:
URL: https://github.com/apache/cordova-ios/issues/1082


   <!--
   Please have a look at the issue templates you get when you click "New issue" in the GitHub UI.
   We very much prefer issues created by using one of these templates.
   -->
   
   ### Issue Type
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x ] Bug Report
   - [ ] Feature Request
   - [ x] Support Question
   
   ## Description
   
   ## Information
   Hello,
   When building app everything is ok, but after that I get some errors.
   Cross origin requests are only supported for HTTP.
   XMLHttpRequest cannot load file:///Users/usr/Library/Developer/CoreSimulator/Devices/A2CB28C4-7FC3-4103-9DA6-DF35D63C0D8C/data/Containers/Bundle/Application/3B8F3587-657F-454C-828A-95AAFD89CA9D/BreezeStaffApp.app/www/static/media/expect-good-news.1bfd09de.mp3 due to access control checks.
   
   ### Command or Code
   Cordova emulate iOS
   
   ### Environment, Platform, Device
   Xcode iOS emulator iOS 14.4 (iPhone 12 pro max)
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   I am using Cordova v 10.0.0 with react on iOS platform.
   Using latest version of Xcode. 
   NPM - 7.5.1 
   -->
   
   ## Checklist
   <!-- Please check the boxes by putting an `x` in the `[ ]` like so: `[x]` -->
   
   - [x ] I searched for already existing GitHub issues about this
   - [x ] I updated all Cordova tooling to their most recent version
   - [x ] I included all the necessary information above
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] breautek commented on issue #1082: Cordova not allowing https cross origin requests.

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #1082:
URL: https://github.com/apache/cordova-ios/issues/1082#issuecomment-785051454


   This is a limitation of the WKWebView which Cordova can't really do anything about. Fortunately there are some workarounds though.
   
   You have three options:
   
   A) For accessing local files, it's best to use the cordova-plugin-file to read the file, where you can read the file as binary and make blob urls to be used in the DOM. However if this isn't possible for whatever reason, such as a framework assumption, then option B or C should be work for you.
   
   B) Use schemes. Schemes I don't think is documented yet, but it is explained in a [blog post](https://cordova.apache.org/howto/2020/07/18/uiwebview-warning.html). All `file://` requests are treated as a cross origin request because when on the `file://` protocol, your origin is null. Schemes will allow your app to make `app://` requests which wouldn't be considered cross origin. This will fix several other issues related to the app running on `file://` in the WKWebView as well. Note that when using schemes, your origin will change. This will result in your app using a different sandbox containers for your web storage, cookies, indexed db, etc. If preserving this data is important for your app, then you'll need to find a plugin to do the data migration.
   
   C) If you can't use schemes, then Oracle has a plugin that resolves XHR issues when using XHR on `file://` urls. Try installing [cordova-plugin-wkwebview-file-xhr](https://github.com/oracle/cordova-plugin-wkwebview-file-xhr). This approach will probbaly be the easiest to a working app but I would only recommend this approach as a last resort or a temporary measure. Migrating to schemes should probably be your goal.
   
   Since this isn't a bug, I'll be closing this issue. If you need more assistance, I welcome you to our [Slack](http://slack.cordova.io/) community where you can ask more questions.
   
   Kind Regards,
   Norman


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] breautek closed issue #1082: Cordova not allowing https cross origin requests.

Posted by GitBox <gi...@apache.org>.
breautek closed issue #1082:
URL: https://github.com/apache/cordova-ios/issues/1082


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org