lib/proxy.js
function injectAuthHeader(req) {
  if (useGateway === true && typeof(config.gateway.auth) === 'string' && req.headers['authorization'] === undefined) {
    req.headers['authorization'] = 'Basic ' + new Buffer(config.gateway.auth).toString('base64');
  }
}
function injectAuthHeader(req) {
  if (useGateway === true && typeof(config.gateway.auth) === 'string' && req.headers['authorization'] === undefined) {
    req.headers['authorization'] = 'Basic ' + new Buffer(config.gateway.auth).toString('base64');
  }
}
function injectAuthHeader ( req ) { if ( useGateway === true && typeof ( config . gateway . auth ) === 'string' && req . headers [ 'authorization' ] === undefined ) { req . headers [ 'authorization' ] = 'Basic ' + new Buffer ( config . gateway . auth ) . toString ( 'base64' ) ; } }
support basic auth for LAN HTTP proxied connections, if needed HACK: http-proxy uses node's http.request().pipe(), which doesn't properly support the options.auth setting like http.request.write() as of Node v0.10.24, so this copies the implementation of request.write() from http.request() SOURCE: https://github.com/joyent/node/blob/828f14556e0daeae7fdac08fceaa90952de63f73/lib/_http_client.js#L84-L88
support basic auth for LAN HTTP proxied connections if needed HACK : http - proxy uses node s http . request () . pipe () which doesn t properly support the options . auth setting like http . request . write () as of Node v0 . 10 . 24 so this copies the implementation of request . write () from http . request () SOURCE : https : // github . com / joyent / node / blob / 828f14556e0daeae7fdac08fceaa90952de63f73 / lib / _http_client . js#L84 - L88