HTTP POST not found 404 ionic with sails.js

I have an ionic app which works well with ionic serve when I make POST orGET requests to my localhost , bt when I make ionic uild android and then ionic run android I always get a 404 POST not found, I tried almost everything. I have added the plugin whitelist and put in my config.xml

  <content src="index.html"/>
  <access origin="*"/>
  <allow-intent href="*"/>
  <allow-navigation href="*"/>

in index html I tried these meta(commented one and uncommented the other)

<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self'> -->

<meta http-equiv="Content-Security-Policy" content="default-src 'self' * ws://localhost:35729 data: gap:; style-src 'self' 'unsafe-inline'; media-src *;script-src 'self' localhost:35729 'unsafe-eval' 'unsafe-inline';">

I use sails as the backend , I think cors are well configured:

module.exports.cors = {

  allRoutes: true,
  origin: '*',

  credentials: true,


  headers: 'content-type, access-control-allow-origin, authorization'

At the beginning of app.js I have this config

.module('frontend', [
  'ionic', 'ionic.service.core',
      anon: 0,
      user: 1,
      admin: 2
  url: "",
  //url: "http://ip_of_my_phone:1337"
  //url: ""
  //url: ""

commented urls are all options I tried : I got them with ifconfig , when it was the case of my phone I disabled the wifi on my computer and used the connection usb of my phone(so the ip was usb0 in ifconfig). I also tried the url “http://localhost:1337” in app.js using port forwarding on chrome://inspect/#devices (by assigning to port 1337 of my device the localhost:1337 of my computer)

But all configuration always give the error POST 404 not found

Any ideas?

1 Like