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

How to proxy without using HTTP CONNECT method #17

Open
joergd opened this issue Feb 9, 2021 · 1 comment
Open

How to proxy without using HTTP CONNECT method #17

joergd opened this issue Feb 9, 2021 · 1 comment

Comments

@joergd
Copy link

joergd commented Feb 9, 2021

I have the following code:

const got = require("got");
const { HttpProxyAgent } = require("hpagent");

let stream = await got.stream("http://www.google.com", {
  agent: {
    http: new HttpProxyAgent({
      keepAlive: false,
      proxy: "http://localhost:3128",
    }),
  },
});

I can see in my proxy (Squid) logs that it receives the request - and it serves the page fine etc. However, I want Squid to cache the result, but Squid is being called using HTTP CONNECT method, which means that I have no way of caching the results on Squid. For any proxy to cache results, it cannot be called using the CONNECT method.

Essentially Got is tunneling the request to Squid using the HttpProxyAgent.

How can I set it up, so that the request is not tunnelled - I just want to connect to the proxy in a normal way (not using CONNECT).

@mbargiel
Copy link
Contributor

Looking at the code, you can't. This library is precisely about tunnelling through HTTP CONNECT. You can take a look at https://github.com/TooTallNate/node-http-proxy-agent which does that, although it's unmaintained.

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