Amazon Elastic load balancer is not populating x-forwarded-proto header
I am trying to force all http requests to https requests and I am facing the problem as elastic load balancer not populating x-forwarded-proto header in the request. This is the code I am using and it is causing redirect loop because of this. How would I fix this problem? app.use (function (req, res, next) { console.log('Request headers = ' + JSON.stringify(req.headers)); console.log('Request protocol = ' + JSON.stringify(req.protocol)); var schema = (req.headers['x-forwarded-proto'] || '').toLowerCase(); if (schema === 'https') { next(); } else { res.redirect('https://' + req.headers.host +