title: How to force SSL / https in Express.js
body: <p>I am trying to create a middleware for Express.js to redirect all non-secure (port 80) traffic to the secured SSL port (443).
  Unfortunately there is no information in an Express.js request that lets you determine if the request comes over http or https.</p>
  
  <p>One solution would be to redirect <strong>every</strong> request but this is not an option for me.</p>
  
  <p>Notes: </p>
  
  <ol>
  <li><p>There is no possibility to handle it with Apache or something else. It <strong>has</strong> to be done in node.</p></li>
  <li><p>Only <strong>one</strong> server can be fired up in the application.</p></li>
  </ol>
  
  <p>How would you solve that?</p>