lib/proxy.js
function redirectToHttps(req, res, target, ssl, log) {
  req.url = req._url || req.url; // Get the original url since we are going to redirect.

  var targetPort = ssl.redirectPort || ssl.port;
  var hostname = req.headers.host.split(':')[0] + ( targetPort ? ':' + targetPort : '' );
  var url = 'https://' + path.join(hostname, req.url);
  log && log.info('Redirecting %s to %s', path.join(req.headers.host, req.url), url);
  //
  // We can use 301 for permanent redirect, but its bad for debugging, we may have it as
  // a configurable option.
  //
  res.writeHead(302, { Location: url });
  res.end();
}
function redirectToHttps(req, res, target, ssl, log) {
  req.url = req._url || req.url; // Get the original url since we are going to redirect.

  var targetPort = ssl.redirectPort || ssl.port;
  var hostname = req.headers.host.split(':')[0] + ( targetPort ? ':' + targetPort : '' );
  var url = 'https://' + path.join(hostname, req.url);
  log && log.info('Redirecting %s to %s', path.join(req.headers.host, req.url), url);
  //
  // We can use 301 for permanent redirect, but its bad for debugging, we may have it as
  // a configurable option.
  //
  res.writeHead(302, { Location: url });
  res.end();
}
function redirectToHttps ( req , res , target , ssl , log ) { req . url = req . _url || req . url ; // Get the original url since we are going to redirect. var targetPort = ssl . redirectPort || ssl . port ; var hostname = req . headers . host . split ( ':' ) [ 0 ] + ( targetPort ? ':' + targetPort : '' ) ; var url = 'https://' + path . join ( hostname , req . url ) ; log && log . info ( 'Redirecting %s to %s' , path . join ( req . headers . host , req . url ) , url ) ; // // We can use 301 for permanent redirect, but its bad for debugging, we may have it as // a configurable option. // res . writeHead ( 302 , { Location : url } ) ; res . end ( ) ; }
Redirect to the HTTPS proxy
Redirect to the HTTPS proxy