Node 环境下 axios 的proxy配置
axios node 代理
·
host是如果是本机那就是127.0.0.1,至于端口取决你的代理设置注意,添加上
const axios = require("axios");
const HttpsProxyAgent = require("https-proxy-agent");
//
const httpsAgent = new HttpsProxyAgent(`http://${YOUR_HOST}:${YOUR_PORT}`);
const axios = Axios.create({
proxy:false,
httpsAgent
})
httpsAgent的时候,需要设置 proxy 为 false,这一点很重要
更多推荐
已为社区贡献4条内容
所有评论(0)