title: What ports should I node.js listen on? How and why?
body: <p>My node.js applications I have listening on port 80 for http and 443 for https, which I believed was fairly standard practice.</p>
  
  <p>However a number of examples I have read recently use other ports (e.g. 8080 and 8081) for listening to http/https, and then use other means such as <code>iptables</code> or <code>ufw</code> rules to serve ports 80 / 443 via rerouting packets to/from the others.</p>
  
  <p>See two examples <a href="https://gist.github.com/kentbrew/776580" rel="noreferrer">here</a> and <a href="https://gist.github.com/benatkin/939400" rel="noreferrer">here</a>. </p>
  
  <p>So my question is <strong>why would I not want to listen directly to ports 80 and 443?</strong> </p>
  
  <p>Are there security issues at hand? Is it simply a case of these authors not having permissions to listen on ports lower than 1024 (I'd find this surprising?)? Do most people run Apache along side node? (I do not).</p>
  
  <p>Assuming there is a good reason for why I don't want to listen directly to 80 and/or 443, <strong>which method should I be using to relay traffic from 80 / 433 to my alternative ports of choice?</strong></p>
  
  <p>I have mentioned iptables and ufw above, is one of these better than the others, or is there some other method I should be using? Does the answer depend on whether I'm balancing my load between processes?</p>
  
  <p>Thanks in advance.</p>