Skip to content

Instantly share code, notes, and snippets.

@alejamp
Created August 5, 2018 13:27
Show Gist options
  • Save alejamp/e0c0a48593536b8b01b5fa4c805ab83c to your computer and use it in GitHub Desktop.
Save alejamp/e0c0a48593536b8b01b5fa4c805ab83c to your computer and use it in GitHub Desktop.
Node.js Create the HTTPS proxy server in front of a HTTP server
var httpProxy = require('http-proxy');
var targetHost = '192.168.6.128';
var port = 8100;
var address = "192.168.0.6";
var port2 = 4100;
const fs = require('fs');
//
// Create the HTTPS proxy server in front of a HTTP server
//
httpProxy.createServer({
target: {
host: targetHost,
port: port
},
ssl: {
key: fs.readFileSync('server.key', 'utf8'),
cert: fs.readFileSync('server.cer', 'utf8')
}
}).listen(port2, address);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment