ALEX BABY
ALEX BABY

Reputation: 17

when i am setting ionic proxy it works on ionic serve but not working build app run on my device

I am setting proxy.conf.json file It works on ionic serve but not working when I am taking build and install to device the api calls are not worked

{
    "/horse": {
      "target": "http://100.24.131.250",
      "secure": false,
      "changeOrigin": true,
      "logLevel": "debug"
    }
  }

Upvotes: 1

Views: 110

Answers (1)

Chanaka Weerasinghe
Chanaka Weerasinghe

Reputation: 5742

Yo have to pass your URL directly instead of Proxy when you run on Device

first check weather app is on localhost or Device

   isApp() 
     {
            return (!document.URL.startsWith('http')document.URL.startsWith('http://localhost:8080'));
     }

then publish your Basepath Or URL like this

if(!isApp())
{
    this.URL="./horse"
}
else
{
    this.URL="www.YourUrl.com"
}

Upvotes: 0

Related Questions