module.exports = function(options) {
    return function(req, res, next) {
        options = options || {};
        var fullUrl = req.protocol + "://" + req.headers.host + req.originalUrl.toLowerCase();
        var url = req.originalUrl.toLowerCase();
        var path = req.path.toLowerCase();

        var indexEndBaseUrl = fullUrl.indexOf("/qmcu/");
        var resourceBaseUrl = indexEndBaseUrl > 0 ? fullUrl.substr(0, indexEndBaseUrl) : fullUrl;
        if (resourceBaseUrl.slice(-1) === '/') {
            resourceBaseUrl = resourceBaseUrl.slice(0, resourceBaseUrl.length - 1);
        }

        var pos = resourceBaseUrl.indexOf('/', 9);
        var proxyPath = pos > -1 ? resourceBaseUrl.substr(pos) : '';

        console.log("fullUrl:" + fullUrl);
        console.log("hostname:" + req.hostname);
        console.log("baseUrl:" + req.baseUrl);
        console.log("URL:" + url);
        console.log("PATH:" + path);
        console.log("indexEndBaseUrl:" + indexEndBaseUrl);
        console.log("resourceBaseUrl:" + resourceBaseUrl);
        console.log("pos:" + pos);
        console.log("proxyPath:" + proxyPath);
        console.log("proxyPath Length: " + proxyPath.length);
        req.proxyPath = proxyPath;
        req.redirectUrl = fullUrl;

        if (req.url.includes("model.qmcUrl")) {
            req.url = req.protocol + "://" + req.headers.host + (req.proxyPath.length > 0 ? req.proxyPath : "") + "/qmcu/";
            req.path = (req.proxyPath.length > 0 ? req.proxyPath : "") + "/qmcu/";
        }


        next();
    }
}
@@ -1260,21 +1260,60 @@
 %0A       
+ //
  if (
+req.url.includes(%22model.qmcurl%22) %7C%7C 
 req.url.
@@ -1339,32 +1339,35 @@
 Url%22)) %7B%0A       
+ //
      req.url = r
@@ -1470,24 +1470,27 @@
 u/%22;%0A       
+ //
      req.pat
@@ -1556,24 +1556,27 @@
 u/%22;%0A       
+ //
  %7D%0A%0A%0A       

resolve issues with realqmc