node-http-proxy SSL connections is not working.
Created by: BadBoy21
I have set up a proxy node-http-proxy server on port 8009. and my actual http server on port 3000. But it seems like they are not working. My code looks like this:
var fs = require('fs');
var httpProxy = require('http-proxy');
httpProxy.createServer({
target: 'http://127.0.0.1:3000/',
ssl: {
key: fs.readFileSync('./sslcerts/key.pem', 'utf8'),
cert: fs.readFileSync('./sslcerts/cert.pem', 'utf8'),
passphrase: 'password1'
},
requestCert: true,
rejectUnauthorized: true
}).listen(8009, function(){
console.log("SSL server started listening on port 8009");
});
// thats the node http proxy
var http = require('http');
var port = 3000;
app.set('port', port);
var server = http.createServer(app);
server.listen(port, function(){
console.log("Express non-SSL server listening on port " + port);
});
Now I have used wireshark to sniff the traffic and there was a post field that was sending data to the https://localhost:8009/ server and it was viewable in plain text on the localhost loopback interface. Not only that, the wireshark protocol detected was http (not TLS/SSL like its supposed to show). there was no indication of TLS handshake or anything like that. I have tested with other legitimate webpages with wireshark and what I found was those webpages have a TLS key handshake like the client hello/server hello stuff but that was not seen when I used wireshark on a request to localhost:8009 https server. So I would like to know what I could do to fix the issue and go through the steps of the TLS server hello/client hello handshake and make sure the data is not being sent on plaintext but rather, encrypted.