code: function updateLink(proxiedUrl, url /*, subdomain*/ ) {
              var next_uri = URL.parse(url);
              if (next_uri.protocol != uri.protocol || next_uri.host != uri.host) {
                  // rewrite the url - we want the old proto and domain, but the new path just in case there are any cookies that are limited to that sub-path (although they won't be on the new protodomain...)
                  var cookieProxiedUrl = config.prefix + uri.protocol + '//' + uri.host + next_uri.pathname + '?' + REDIRECT_QUERY_PARAM + '=' + encodeURIComponent(url);
                  debug('rewriting link from %s to %s in order to allow cookies to be copied over to new path', proxiedUrl, cookieProxiedUrl);
                  return cookieProxiedUrl;
              } else {
                  // if neither the proto nor the host have changed, just replace it with the same string
                  return proxiedUrl;
              }
          }
docs: takes a link that switches protocol and/or subdomain and makes it first go through the cookie handler on the current protocol/sub and then redirect with the cookies coppied over