0

Following example is taken from the github page of node-http-proxy

HTTPS -> HTTP

//
// Create the HTTPS proxy server in front of a HTTP server
//
httpProxy.createServer({
  target: {
    host: 'localhost',
    port: 9009
  },
  ssl: {
    key: fs.readFileSync('valid-ssl-key.pem', 'utf8'),
    cert: fs.readFileSync('valid-ssl-cert.pem', 'utf8')
  }
}).listen(8009);


Question: Why is httpProxy not listening to port 443 for secure SSL traffic?

vjjj
  • 1,019
  • 3
  • 10
  • 35

1 Answers1

0

SSL has default port which is 443 but like with regular HTTP protocol which also has default 80 port it could be bind to a custom port and accessed by specifying a port in the url(https://localhost:8009). Based on this answer.

Community
  • 1
  • 1
G07cha
  • 4,009
  • 2
  • 22
  • 39
  • I see, but it would result in unnecessarily complicated urls like https://www.example.com:8009/foobar.html – vjjj Jun 22 '16 at 07:12
  • Right, in most cases, using 443 port is more than enough but sometimes, for example when you hosting multiple sites on one server you should handle port conflicts and as a result, use a custom port for SSL. – G07cha Jun 22 '16 at 07:14