Corporate-Proxy

示例代码是结合公司代理创建的代理。

结合 https-proxy-agent 创建自定义的 http.agent 来链接公司代理服务。

var HttpsProxyAgent = require('https-proxy-agent');
var proxyMiddleware = require("http-proxy-middleware");

// 连接公司代理
var proxyServer = process.env.HTTPS_PROXY ||
                  process.env.HTTP_PROXY;

var options = {
    target: 'http://localhost:3000',
    agent: new HttpsProxyAgent(proxyServer)
};

var proxy = proxyMiddleware('/api', options);

results matching ""

    No results matching ""