Is express still cross-domain after forwarding the request?

problem description

request a third-party interface, and use node, express and http-proxy-middleware to build a server to forward the request.
the front end sends the request using fetch. Some interfaces are accessible, while others are still prompted to cross-domain.

Q:

Why is this the case? if you request the server to forward the data directly in the browser, you can get the data normally. But sending a request with fetch prompts you to cross-domain.

some configurations of fetch:

const getFetch =(url)=> {
    try {
      let result = fetch(url, {
        // credentials: "omit",
        // "Content-Type": "application/json;charset=utf-8",
        // headers: {
        //   "Access-Control-Allow-Origin": "*",
          // Accept: "application/json, text/plain, */*"
          // "Content-Type": "application/json;charset=utf-8"
        // },
        // mode: "cors" 
      })
      return result.then(res=>res.json());
    }catch(err){
      console.error(err)
    }
}
const postFetch =(url,data)=> {

  let obj2params = (obj) => {

    let item, result = ""

    for ( item in obj ) {
      result += "&" + item + "=" + encodeURIComponent(obj[item]);
    }
    if (result) {
      result = result.slice(1);
    }
    return result;
  }
  
  try {
    let result = fetch(url, {
      method: "POST",
      credentials: "omit", 
      headers: {
        "Accept": "application/json, text/plain, */*",
        "Content-Type": "application/json"
      },
      // body: obj2params(data)
      body: JSON.stringify(data)
    });
    return result.then(res=>res.json());

  }catch(err) {
    console.error(err);
  }
}

browser normal request

The

Access-Control-Allow-Origin
browser did make a request. Only when the header of Access-Control-Allow-Origin is included in the response of the target page, and its value has our own domain name, the browser allows us to get the data of its page for further processing.

Menu