Why do you use a back-end agent or report to invalid referer??

when I tried to grab the song list information of QQ Music"s playlist, I wanted to use the backend proxy to cross-domain, but I still reported that invalid referer, didn"t understand what the problem was.

export function getSongList(disstid) {
  const url = "/api/getSongList";
  const data = {
    disstid,
    type: 1,
    json: 1,
    utf8: 1,
    format: "json",
    g_tk: 5381,
    loginUin: 1666707506,
    hostUin: 0,
    inCharset: "utf8",
    outCharset: "utf-8",
    notice: 0,
    platform: "h5",
    needNewCode: 1,
    new_format: 1,
    onlysong: 0,
    picmid: 1,
    nosign: 1,
    song_begin: 0,
    song_num: 100,
    _: 1541664934895,
  };

  return axios.get(url, {
    params: data,
  }).then(res => Promise.resolve(res.data));
}

backend

  app.get("/api/getSongList", function(req, res) {
    const url = "https://c.y.qq.com/qzone/fcg-bin/fcg_ucc_getcdinfo_byids_cp.fcg";
    axios.get(url, {
      headers: {
        referer: "https://c.y.qq.com",
        host: "c.y.qq.com"
      },
      params: req.query
    }).then((response) => {
      res.json(response.data);
    }).catch((e) => {
      console.log(e);
    })
  });

all the previous back-end proxy requests can get data,
but the response of the console console is like this

clipboard.png

clipboard.png
the host and referer here do not seem to have changed. Is the backend agent wrong?

Oct.29,2021

add User-Agent to try

Menu