code: function miscellaneous() {
    return function(req, res, next) {
      var userAgent = req.headers["user-agent"];
      var xForwardedProto = req.headers["x-forwarded-proto"];
      var referer = req.headers["referer"] || "";
  
      //-- set SSL flag
      req.usingSSL = /^https$/i.test(xForwardedProto);
  
      //-- modify base url if using ssl
      if (req.usingSSL) {
        req.baseUrl = (req.baseUrl || "").replace("http:", "https:");
      }
  
      //-- set referer
      var pattern = "https?://" + req.host + "(:[0-9]+)?([^?]*)";
      var match = referer.match(new RegExp(pattern));
      req.referer = (match) ? match[2] || "/" : referer;
  
      //-- set isMobile property
      req.isMobile = /^m\./i.test(req.host) || /opera mini/i.test(userAgent) || !!(req.session.isMobile);
      if (!req.isMobile) {
        req.isMobile = req.session.isMobile = (req.query.m === ".");
      }
  
      //-- Util
      res.locals.Util = Util;
  
      next();
    };
  }
docs: ------------------------------------------------------------------------------