Search code examples
androidangularjsionic-frameworkcordova-plugins

Crosswalk browser for Android throws “Only secure origins are allowed” error


I thought this would be a common issue but I can't find an straight-forward answer to this problem. As soon as I included the Crosswalk WebView Engine for Android I'm getting the following Error Message:

"Only secure origins are allowed"

.... Presumably for http requests made to local and external servers (like http://localhost:3000 or https://my.own.server/) using the angular $http service.

What is THE Solution to this issue? After many hours of Googling I'm still clueless about how to solve this issue. Could you please point me in the right direction?

kind regards,

EDIT: This question is not related to permissions given in a server as it has been pointed out, it's actually related to Content Security Policy. As it can be read here, and I quote:

Controls which network requests (images, XHRs, etc) are allowed to be made (via webview directly).

You have to understand that the WebView in this case is Crosswalk (which is Chromium underneath) and I need it to be configured so that I can make requests to both: local servers (http://localhost:3000, etc) and external ones (https://my.own.server). This question is more akin to this one in my opinion.

How do I configure Crosswalk for an Ionic/Cordova app?


Solution

  • If you own the server then the easiest way to handle this is to add response header for:

    Access-Control-Allow-Origin: *
    

    Here are some a discussion in Stackoverflow itself.

    Origin is not allowed by Access-Control-Allow-Origin

    Good luck.