Crosswalk and $http doesnt work

I tried a new app with simple $http.get, $http.post and $http.put calls. I settet up an express node-server on my root-server. I’m using the latest Versions of Ionic, node, npm, express, npm cors, etc.

Im using following plugins (but i dont think they are the reason, try that later without them)
ionic plugin add org.apache.cordova.console
ionic plugin add org.apache.cordova.device
ionic plugin add org.apache.cordova.dialogs
ionic plugin add org.apache.cordova.file
ionic plugin add org.apache.cordova.media
ionic plugin add https://github.com/phonegap-build/PushPlugin
ionic plugin add https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git


without the crosswalk-browser all works fine on the device.

if i add the crosswalk-browser with “ionic browser add crosswalk” i got for all http-calls a 404 error!

4 Likes

same here - any news?
if i inspect with chrome you can see crosswalk is loading every request “from cache”, even the first requests
what ends always in 404

Same. 404 errors on all request.

Have you checked what is the url being requested? I mean, probably you are doing $http.get('some-url') and then the actual url requested may be like this one file://android_assets/some-url.

no, the request goes to the right external url (with hostname), but in chrome you can see the “from cache” flag.
the request is not sent over the network, the response comes direct from the cache (even the first request).
and its always an 404 response.
same for localhost and for direct ip’s (no hostnames).

1 Like

I am also getting 404 status codes. Was working prior to introducing Crosswalk. Works fine on the desktop but not on device when Crosswalk was added. Using ionic RC2. Crosswalk version: 12.41.296.5

I tried installing the last 4 specific versions of crosswalk with no luck, so the crosswalk version doesn’t seem to matter.

I have same issue, are there some tricks to resolve?

i’ve tried this versions:

10.39.235.15
11.40.277.7
12.41.296.5
13.41.318.0

…with no luck

for more infos, see there:

have already tried this, I’ve created a ionic.project file like this, without success.

{
  "name": "testapp",
  "app_id": "",
  "xwalk_hosts": [
    "http://*/",
    "https://*/"
  ],
  "browsers": [
    {
      "platform": "android",
      "browser": "crosswalk",
      "version": "12.41.296.5"
    }
  ]
}

also i think this is not the problem, the xwalk_hosts are for the “Access-Control-Allow-Origin”-Header

just found a fix, more infos:

1 Like

Thanks for this. Worked for me like a charm. :grinning:

1 Like

Thanks for the workaround! Seems like there is a very bad regression on the crosswalk plugin, as 1 month ago every crosswalk versions worked like a charm when I used it. I was banging my head on the wall today because of this dreaded 404 issue with crosswalk :sweat:

Anyone knows on which bug tracker we should report this?

The Crosswalk project uses JIRA. https://crosswalk-project.org/jira/secure/Dashboard.jspa. You’ll need to sign up.

Just started working on adding Android support to my app and ran into this problem, but I can’t seem to get your workaround to work. Am I doing this right?

In the file

engine/cordova-crosswalk-engine-c0.7.1/src/android/XWalkCordovaResourceClient.java

I am commenting line 204, which looks like this:

return new WebResourceResponse("text/plain", "UTF-8", null);

Next I run

ionic build android

and finally I run the app on the device

ionic run android

The $http request still fails with a 404 – am I missing a step? Thanks!

Finally, got the reason behind, this is not a bug.

Here is the Cordova android 4.0.0 changelog:

Major Changes
[...]
-  Whitelist functionality is now provided via plugin (CB-7747) The
   whitelist has been enhanced to be more secure and configurable
   Setting of Content-Security-Policy is now supported by the framework
   (see details in plugin readme) You will need to add the new
   cordova-plugin-whitelist plugin Legacy whitelist behaviour is still
   available via plugin (although not recommended).

You need the following plugin: https://github.com/apache/cordova-plugin-whitelist so that <access origin="*"/> behaves properly now.

6 Likes

adding cordova-plugin-whitelist and the appropriate access tags in config.xml doesn’t solve the issue.

--------- EDIT -------------------

Remove meta tag for CSP, added lines in config.xml seems to work fine now:
<access origin="*"/> <allow-intent href="*"/> <allow-navigation href="*"/>

2 Likes

i have added the following and do not have meta tag for csp and still no luck any ideas?