そのためのNPMモジュールがあります:
https://www.npmjs.com/package/global-tunnel
var globalTunnel = require('global-tunnel');
globalTunnel.initialize({
host: '10.0.0.10',
port: 8080,
sockets: 50 // optional pool size for each http and https
});
それとものみプロキシ特定の要求する場合は、あなたがグローバルトンネルの原動力であるトンネルパッケージを(使用することができます上記):
https://www.npmjs.com/package/tunnel
var tunnel = require('tunnel');
// create the agent
var tunnelingAgent = tunnel.httpsOverHttps({
proxy: {
host: 'localhost',
port: 3128
}
});
var req = https.request({
host: 'example.com',
port: 443,
// pass the agent in your request options
agent: tunnelingAgent
});
よ可能性http.globalAgentを使用した例を示します。{host: 'http.proxy.somewhere.com'、ポート:1234、パス: 'http://www.google.com'} 'を私の会社のプロキシがhttp:// httpであるところで、http://www.globalAgent.options = {host: 'http.proxy.somewhere.com'、port:1234} .proxy.somewhere.com:1234'で動作しませんでした。 – jonnie
はい、すべての発信リクエストを、globalAgentのプロキシ経由でルーティングする例を示してください。 –