Closed rebazomar121 closed 2 years ago
Hi, I think it may be better to expose the proxy option agent
of got
. Will do it later.
Hi, I think it may be better to expose the proxy option
agent
ofgot
. Will do it later.
Hi, I try agent but it doesn't work, can I send data via Axios or request or just we can use got, I try it doesn't work , so now I want to change the proxy for around 30 days I'm searching to it but i can't find any way to fix it, if you can get me peace of this got request with using proxy, i try it const { body } = await got.post("http://ip-api.com/json", { headers: requestHeaders, body: requestBody, responseType: 'json', }, { agent: { https: new HttpProxyAgent({ keepAlive: true, keepAliveMsecs: 1000, maxSockets: 256, maxFreeSockets: 256, scheduling: 'lifo', proxy: proxyUrl }) } }) but it doesn't work
It's a bit strange that agent
doesn't work. It seems you were configuring the agent incorrectly.
I tried this and it works.
const { body } = await got.post('http://ip-api.com/json', {
// headers: requestHeaders,
// body: requestBody,
responseType: 'json',
agent: {
http: new HttpProxyAgent({
keepAlive: true,
keepAliveMsecs: 1000,
maxSockets: 256,
maxFreeSockets: 256,
scheduling: 'lifo',
proxy: 'PROXY ENDPOINT'
})
}
})
Released v2.4.0 on npm.
thank for you it doesn't work for me so I try this code
const { bootstrap } = require('global-agent');
process.env.GLOBAL_AGENT_HTTP_PROXY = proxyUrl;
process.env.NODE_TLS_REJECT_UNAUTHORIZED = false;
bootstrap();
after that, I did write this inside got
https: {
rejectUnauthorized: false
},
now it working.......
I'm blocked when I use bing-translator-API, so I try using a proxy for my server but it uses (got) to send API, and don't have an idea how to set proxy with this (got).