I've upgraded my Node.js to the latest version which supports fetch natively. I'm trying to use a free public proxy to test, however when I'm making a request, it still comes from me directly. I know that because I'm calling an "Get my IP" service, and it returns my hope IP.
Here's the code example:
const HttpsProxyAgent = require('https-proxy-agent');
fetch(`https://api.ipify.org?format=json`, {agent: new HttpsProxyAgent("36.32.21.45:8085")})
.then(res => res.json()).then(res => console.log(res));
Tried putting proxy settings in the header as well this way:
const proxyAgent = require("proxy-agent");
(async () => {
const res = await fetch('https://api.ipify.org?format=json', {
headers: {
agent: new proxyAgent('http://80.48.119.28:8080'),
}
});
const data = await res.json();
console.log(data); //it shows my ip
})();
What am I missing?