Automatic redirect non HTTP to HTTPS connection in node.js/express
If you want to redirect your website to HTTPS connection implement bellow code var app = require(‘express’)(); app.use(function(req,res,next) { if(req.headers[“x-forwarded-proto”] == “http”) { res.redirect(“https://trinitytuts.com” + req.url); } else { return next(); } }); Hope this small tip help you 🙂
Continue Reading