Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

intercept local requests #520

Closed
korizyx opened this issue Jul 28, 2023 · 2 comments
Closed

intercept local requests #520

korizyx opened this issue Jul 28, 2023 · 2 comments

Comments

@korizyx
Copy link

korizyx commented Jul 28, 2023

I was trying to capture the request I'm making using the node itself, but it doesn't return me anything the proxy-chain event functions, follow the code below:

import ProxyChain from "proxy-chain";
import krop from "krop";

const server = new ProxyChain.Server({ port: 8001 });

server.listen(() => {
  console.log(`Proxy server is listening on port ${8001}`);
});

// Emitted when HTTP connection is closed
server.on("connectionClosed", ({ connectionId, stats }) => {
  console.log(`Connection ${connectionId} closed`);
  console.dir(stats);
});

// Emitted when HTTP request fails
server.on("requestFailed", ({ request, error }) => {
  console.log(`Request ${request.url} failed`);
  console.error(error);
});

await krop("www.google.com", {
  http2: true,
  proxy: "127.0.0.1:8001",
});
  • nodejs v18.17.0
  • ESM
  • proxy-chain v2.3.0
  • windows 11
@Tankonyako
Copy link

Hello you can filter requests using prepareRequestFunction, req.url or hostname

@korizyx
Copy link
Author

korizyx commented Aug 3, 2023

thx

@korizyx korizyx closed this as completed Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants