title: Heroku nodejs- redirect HTTP to HTTPS
body: <p>I am working on <code>Progressive Web App</code> and when testing it with Lighthouse I get:</p>
  
  <p>Does not redirect HTTP traffic to HTTPS</p>
  
  <p>My server is in nodejs and it is on Heroku. I was trying to add this code:</p>
  
  <pre><code>app.get('*',function(req,res,next){
    if(req.headers['x-forwarded-proto']!='https'){
      res.redirect(`https://${req.header('host')}${req.url}`)
    }else{
      next()
    }
  })
  </code></pre>
  
  <p>But it didn't help. Any ideas how to solve that?</p>