nodejitsu/node-http-proxy — Issue #197: How to set up a Forward Proxy for HTTPS request ?
Author: penkween
Created: 2012-02-16 18:10:26+00:00
State: open

Hi,

Forward Proxy for HTTP request - OK
========================================================
httpProxy.createServer(function (req, res, proxy) { //===> This create a Forward Proxy
uri = url.parse(req.url);
var port = 80;
proxy.proxyRequest(req, res, {
host: uri.hostname,
port: port
});
}).listen(8000);

The above Forward Proxy can only proxy to HTTP (not HTTPS) page, for HTTPS site eg. https://github.com/nodejitsu/node-http-proxy , this proxy simply fail to do it.

Forward Proxy for HTTPS request - How ????
========================================================
var opts = helpers.loadHttps();
httpProxy.createServer(8000, 'localhost', { //===> This create a Forward Proxy
https: opts,
target: {
https: true
}
}).listen(8080);

https.createServer(opts, function (req, res) { //==>This create a local Target HTTPS server
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.write('hello https\n');
res.end();
}).listen(8000);

With referring the sample "proxy-https-to-https.js", it only help proxy all HTTPS request to the local Target HTTPS server whic is running at PORT=8000. How do we make it to proxy to any EXTERNAL HTTPS page eg. https://github.com/nodejitsu/node-http-proxy ?