node-http-proxy icon indicating copy to clipboard operation
node-http-proxy copied to clipboard

can't proxy https request

Open ghost opened this issue 8 years ago • 9 comments

My script looks like this:

var http = require('http'),
httpProxy = require('http-proxy');

var addresses = [
  {
    host: 'localhost',
    port: 8888
  },
];
var proxy = httpProxy.createServer();

http.createServer(function (req, res) {
  var target = { target: addresses.shift() };
  console.log('balancing request to: ', target);
  proxy.web(req, res, target);
  addresses.push(target.target);
}).listen(5050);

When I do: curl http://httpbin.org/ip it works, but when I do: curl https://httpbin.org/ip I get: curl: (56) Proxy CONNECT aborted

ghost avatar Oct 10 '17 03:10 ghost

I'm no expert, but I believe this question is better asked in a QA site, normally issues are raised to do with the code based, rather than a HOW TO. Maybe try stack overflow.

hutber avatar Oct 24 '17 09:10 hutber

Not super-helpful, @hutber.

On Tue, Oct 24, 2017 at 5:28 PM, Jamie Hutber [email protected] wrote:

I'm no expert, but I believe this question is better asked in a QA site, normally issues are raised to do with the code based, rather than a HOW TO. Maybe try stack overflow.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nodejitsu/node-http-proxy/issues/1206#issuecomment-338930584, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1afBhSRM3_Qh_hNgcNpqWbobpBWnKOks5sva2kgaJpZM4PzT7t .

ghost avatar Oct 24 '17 09:10 ghost

@monkeysuffrage did you figure this one out?

geraintwhite avatar Mar 05 '18 09:03 geraintwhite

@monkeysuffrage it was meant to encourage you to ask the question on another site designed for asking for help about your implimentation, github is used for issue reporting. Maybe start another question on one of the QA sites and then link to it from here.

hutber avatar Mar 05 '18 09:03 hutber

Well it feels like an issue to me and nobody's bothered to close it after all this time...

On Mon, Mar 5, 2018 at 5:45 PM, Jamie Hutber [email protected] wrote:

@monkeysuffrage https://github.com/monkeysuffrage it was meant to encourage you to ask the question on another site designed for asking for help about your implimentation, github is used for issue reporting. Maybe start another question on one of the QA sites and then link to it from here.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nodejitsu/node-http-proxy/issues/1206#issuecomment-370364143, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1afI2LER23BH2SuuDulXqESlOjwDFyks5tbQlOgaJpZM4PzT7t .

ghost avatar Mar 05 '18 10:03 ghost

Yep totally :) Was just a suggestion from my end. Not trying to be a dick

hutber avatar Mar 05 '18 10:03 hutber

@monkeysuffrage This lib does not support https request. You need to implement it by yourself. Basicly you need to implement the http CONNECT method. You can find more infomation here https://stackoverflow.com/questions/8165570/https-proxy-server-in-node-js

flyxl avatar Mar 26 '18 16:03 flyxl

I found a really good proxy lib that I'm using instead that handles HTTP/HTTPS out of the box: https://github.com/alibaba/anyproxy. It might be too heavy or non-configurable for what you want.

geraintwhite avatar Mar 26 '18 16:03 geraintwhite

It's 2023, Does the Issue still exist, or any work around there to figure it out?

Nishchit14 avatar May 07 '23 09:05 Nishchit14