request/tunnel-agent

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

Closed this issue · 1 comments

touv commented

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.