Open lukekarrys opened 2 months ago
Latest commit: 8c4833d9d641cea233b51100c8ce1238f21271dd
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated (UTC) |
---|---|---|---|
proxy-agents | ✅ Ready (Inspect) | Visit Preview | Mar 31, 2024 8:01pm |
Sorry if this is the wrong place to ask this, but I'm interested in the functionality of this PR.
I managed to define the outgoing interface for requests via CLI, but I wanted to do this via code.
Could you tell me how to do this?
You can set localAddress
on the server returned from createProxy:
import * as http from 'http';
import { createProxy } from 'proxy';
const server = createProxy(http.createServer());
server.localAddress = LOCALADDRESS;
server.listen(3128, () => {
var port = server.address().port;
console.log('HTTP(s) proxy server listening on port %d', port);
});
You can set
localAddress
on the server returned from createProxy:import * as http from 'http'; import { createProxy } from 'proxy'; const server = createProxy(http.createServer()); server.localAddress = LOCALADDRESS; server.listen(3128, () => { var port = server.address().port; console.log('HTTP(s) proxy server listening on port %d', port); });
Thank you very much, I was looking for this