Have a Axios error "Request failed with status code 404" in createError

Hi anyone, i am using nuxtjs for my project. But i have a problem, on mode ssr(server side render) when run project is axios throw error Request failed with status code 404:


Code:

import axios from "axios";
export class ApiConnect {
  constructor({ commit, key_commit }) {
    this.commit = commit ? commit : null;
    this.key_commit = key_commit ? key_commit : null;
  }
  
  async get(url) {
    console.time(url);
    await axios
      .get(url)
      .then(response => {
        if (response.data.status != 200) {
          throw "404";
        }
        this.commit(this.key_commit, { data: response.data.data });
        console.timeEnd(url);
      })
      .catch(error => {
        console.log("api error:" + error);
        throw error;
      });
  }
}

Error in terminal:
image

But on mode spa(client side render) then project keep running normal.
Sorry my english is very bad. :slight_smile:
Thanks anyone.

Thanks anyone, I was resolve this problem. Because i config url of api is " //domainapi.com" when on web browser can running normal but on nodejs server in can’t running with “//domain” instead have to edit is “http://domain