ReactJS – React javascript NodeJS discussions and coding techniques

ReactJS expressjs server redirect domain from http to https://www

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #119
    Murali
    Keymaster

    To redirect domain from plain http or https:// to https://www

    Below code is in REACTJS express server file

    app.all(/.*/, function(req, res, next) {
      var host = req.header("host");
      if (host.match(/^www\..*/i)) {
        next();
      } else {
        res.redirect(301, "http://www." + host + req.path);
      }
    });
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
Would you like to install our Progressive web app?

Would you like to install our Progressive web app?

Progressive Web App (PWA) is installed successfully. It will also work in offline