Network error when axios call has parameters on IOS

I’m using axios for all my api calls on my Ionic App with Vue. When I build my app on Xcode I got the error “Network error”.

{"message":"Network Error","name":"Error","stack":"capacitor://localhost/js/chunk-vendors.48c94d63.js:3:19640\ncapacitor://localhost/js/chunk-vendors.48c94d63.js:24:8990","config":{"url":"URL","method":"post","data":"{\"page\":1}","headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json;charset=utf-8"},"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1}}

I saw that this error occurs only when I have parameters"API CALL", {
        .then((response) => {
            // console.log(;
            this.loaded = true;
        .catch(async (err) => {

When removing parameters, no errors. Server side, the CORS settings are OK.

I don’t know where to debug this problem

  1. Are you testing on an iOS beta release?
  2. Are you making a request to an HTTPS endpoint?


No I’m on macOS Big Sur 11.4 and Xcode 12.5.1

And yes all my endpoints are on https. All is ok when no parameters…

Shot in the dark, but could you do the same request with built-in fetch?

  method: 'POST',
  headers: new Headers({
    'Accept': 'application/json',
    'Content-Type': 'application/json',
  body: JSON.stringify({page:})
.then((response) => response.json())
.then((res) => {
.catch((error) => {
1 Like

I didn’t think of using fetch, It’s the same problem but fetch returns a better error information !
The error was that capacitor://localhost was not allowed by origin.

I was able to realize that my CORS configuration was not good

Thanks to you @mhartington


Glad you got it worked out!

Can i know how to resolve this issue?
i got a similar issue…

1 Like

Please can you elaborate on your solution??

thank you