http-party / node-http-proxy

A full-featured http proxy for node.js
https://github.com/http-party/node-http-proxy
Other
13.95k stars 1.98k forks source link

Probems proxying HTTPS requests #880

Open msmolyak opened 9 years ago

msmolyak commented 9 years ago

I am trying to build an end-point in my node app allowing the client running in the browser to proxy an arbitrary request. The both my Node.js server and the endpoint it is proxying to are HTTPS servers.

I am using

proxy = httpsProxy.createProxyServer({ssl: sslOptions})

where sslOptions point to the public and private key.

At the point of proxying the request I call

proxy.web(req, res, {target: someHttpsUrl})

The problem is that the target server responds with an error stating the it did not receive the certificates in the proxied request. Do I need to pass certificates in web() function invocation? Why would certificates not be sent to the target?

predhme commented 8 years ago

I am encountering the exact same issue. I have tried passing the cert from the request socket into the options parameter for the web

{ target: url, cert: request.socket.getPeerCertificate() }

However, the server the request is being proxied to is complaining that there was no certificate present in the request.

assaflei commented 7 years ago

I having the same issue currently, Tried getting the client certificate from these objects in the proxyReq event: proxyReq.connection.getPeerCertificate() req.connection.getPeerCertificate() proxyReq.socketgetPeerCertificate() req.socket.getPeerCertificate()

I noticed that the usual examples involve the proxy generating a new certificate and send it to the next layer What require is to forward a certificate the proxy's clients create

Is this feature available?