Answer the question
In order to leave comments, you need to log in
How to properly use proxy in node.js?
I have a list of proxies that need to be used in turn to access an external api.
I am doing this now:
var proxy_array = new Array();
for (var key in proxy) {
proxy_array.push(request.defaults({'proxy': proxy[key] }))
}
In proxy[key] - proxy address
Next, I use this simply by selecting an array element: proxy_array[0] proxy_array [1] and so on
Everything works, but if the application crashes/scheduled restart - connections to the proxy remain hanging and eventually run into the limit of simultaneous connections to the proxy.
And in general, such a solution does not seem very beautiful to me. How to solve the problem?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question