Req.secure in Node alwys false
<p>Im trying to redirect HTTP requests to my site to HTTPS. Its been extraordinarily hard. My code is:</p>

<pre><code>var express = require('express');
var app = express();


app.use(function(req, res, next) {

  console.log('req.protocol is ', req.protocol);
  console.log('req.secure is ', req.secure);


  if (req.url !== '/health' &amp;&amp; !req.secure) {
    console.log('redirecting .........');
    return res.redirect('https://www.example.net/catch');

  }
  next();
});


app.get('/catch', function(req, res) {
  res.send('Hello World!');
});

app.get('/', function(req, res) {
  res.send('Hello World!');
});

app.get('/health', function(req, res) {
  res.send('Hello World!');
});


app.listen(8080, function() {
  console.log('Example app listening on port 8080!');
});
</code></pre>

<p>The load Balancer health check goes to '/health'. Every other request that isnt a health check, and is HTTP (rather than HTTPS) should be caught and redirected to https. However, I end up in an infinite loop as req.protocol always returns 'http' for http or https requests. req.secure therefore is false every time and I end up in a loop. Any ideas why this is? </p>