
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
node-cookie-proxy-agent
Advanced tools
HTTP & HTTPS agents with cookie and proxy support. HTTP(s) and SOCKS(v4/v5) are supported.
npm install node-cookie-proxy-agent http-proxy-agent https-proxy-agent socks-proxy-agent tough-cookie
Pass node-cookie-proxy-agent
to HTTP clients instead of http(s).Agent.
Exemple with axios
with HTTP proxy:
import axios from 'axios';
import { HttpCookieProxyAgent, HttpsCookieProxyAgent } from 'node-cookie-proxy-agent';
import { CookieJar } from 'tough-cookie';
// HTTP(s) proxy
(async () => {
// initialise this first
const jar = new CookieJar();
const proxy = 'http://127.0.0.1:8888'; // or http://id:password@127.0.0.1:8888 to use with authentication
const httpAgent = new HttpCookieProxyAgent(jar, proxy);
const httpsAgent = new HttpsCookieProxyAgent(jar, proxy);
// add your agents to your http client
const axiosClient = axios.create({ httpAgent, httpsAgent });
console.log('result: ', (await axiosClient.get('https://api.ipify.org?format=json')).data);
})().catch(err => console.error(err));
Exemple with axios
with SOCKS proxy:
import axios from 'axios';
import { SocksCookieProxyAgent } from 'node-cookie-proxy-agent';
import { CookieJar } from 'tough-cookie';
// SOCKS proxy
(async () => {
// initialise this first
const jar = new CookieJar();
const agent = new SocksCookieProxyAgent(jar, 'socks://127.0.0.1:8888');
// add your agent to your http client
const axiosClient = axios.create({ httpAgent: agent, httpsAgent: agent });
console.log('result: ', (await axiosClient.get('https://api.ipify.org?format=json')).data);
})().catch(err => console.error(err));
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.