Axios + HTTP request not working on a physical device

I think I fixed it.

Those are the lines I added to my capacitor.config.js (don’t know which one actually fixed, but requests are working now). Now going to bed.

"server": {
    "androidScheme": "http",
    "allowNavigation": [
      "my.api.url"
    ]
  }

Capacitor Configuration - Documentation

Try and see if it works for you.

Update: I removed “androidScheme”: “http” and left “allowNavigation” field and looks like everything’s fine now. I’ll see tomorrow if the problem is really solved.

Update 2: Important thing is that it still does not work if I try that using non-https API, I had to use https API to get a response from server. But at least I know where is the problem.

2 Likes