Answer the question
In order to leave comments, you need to log in
How to send a request through a proxy?
I have a proxy address that looks something like this: 185.233.80.131 : 9122 : GVF7nV : kbh32Z (ip address : port : login : password). To send a request through a proxy, I use Tunnel .
const tunnelingAgent = tunnel.httpOverHttps({
proxy: getProxyOptions(),
});
const req = https.request(
{
host: 'url сайта, к которому хочу обратиться через proxy',
port: 443,
agent: tunnelingAgent,
},
(res) => {
console.log(res);
}
);
function getProxyOptions() {
return {
host: '185.233.80.131',
port: 9122,
proxyAuth: 'GVF7nV:kbh32Z'
};
}
function getProxyOptions() {
return {
host: 'http://185.233.80.131',
port: 9122,
proxyAuth: 'GVF7nV:kbh32Z'
};
}
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