request / tunnel-agent

HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.
Apache License 2.0
117 stars 105 forks source link

forcing tunneling http request over a proxy is not all the time a good idea #30

Closed touv closed 7 years ago

touv commented 7 years ago

My use case is:

I have a proxy (myproxy:8080) allowing only CONNECT method for HTTPS (443) requests. If I use CONNECT method for a request on another port (ex: 80) it returns a 403 response.

If i do a request on a HTTPS web site it works, ex with omni-fetch:

const fetch = require('omni-fetch');
fetch('https://google.com').then(console.log);

If i do a requst on a HTTP web site it does not work, ex with omni-fetch:

const fetch = require('omni-fetch');
fetch('http://agilemanifesto.org/iso/fr/manifesto.html').then(console.log);

Because tunnel-agent is doing something like that: CONNECT myproxy:8080 agilemanifesto.org:80

And the proxy is not allowing to use CONNECT for a website not using 443 port. I got: HTTP/1.0 403 Forbidden

It should work if the request to the proxy just use the classic GET method. For example: GET agilemanifesto.org http://agilemanifesto.org/iso/fr/manifesto.html HTTP/1.1

This is strange because this behavior is ok with the https://github.com/request/request node module.

touv commented 7 years ago

see https://github.com/marionebl/omni-fetch/issues/5