-
Notifications
You must be signed in to change notification settings - Fork 166
Closed
Description
I have couple of proxy around the world. I want change proxy when I know URL of request.
I use "https-proxy-agent" - https://www.npmjs.com/package/https-proxy-agent
I try change proxy.httpsAgent, closed server (proxy.close()) and strart again (proxy.listen({....})) my proxy server but this method don't work.
proxy.onRequest(function(ctx, callback) {
ctx.use(Proxy.gunzip);
console.log("--URL:",ctx.clientToProxyRequest.url);
dbLib.getProxy(ctx.clientToProxyRequest.url, function() {
if (global.proxy.length > 5){
proxy.close();
myproxy = process.env.http_proxy || 'http://'+global.proxy+':3128';
myAgent = new HttpsProxyAgent(myproxy);
proxy.httpsAgent = myAgent;
proxy.httpAgent = myAgent;
proxy.listen({port: 8800, forceSNI: true});
proxy.httpsAgent = myAgent;
proxy.httpAgent = myAgent;
}
});
Metadata
Metadata
Assignees
Labels
No labels