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.

Manage push notifications

notification icon
We would like to show you notifications for the latest news and updates.
notification icon
Please wait...processing
notification icon
We would like to show you notifications for the latest news and updates.
notification icon
Please wait...processing