Skip to content

Commit

Permalink
auth header added
Browse files Browse the repository at this point in the history
  • Loading branch information
ashubham committed Mar 12, 2015
1 parent 245d73a commit ab5c3e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/http-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports.createProxyServer =
* prependPath: <true/false, Default: true - specify whether you want to prepend the target's path to the proxy path>
* localAddress : <Local interface string to bind for outgoing connections>
* changeOrigin: <true/false, Default: false - changes the origin of the host header to the target URL>
* auth : Basic authentication i.e. 'user:password' to compute an Authorization header.
* hostRewrite: rewrites the location hostname on (301/302/307/308) redirects, Default: null.
* }
*
Expand Down
4 changes: 4 additions & 0 deletions lib/http-proxy/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ common.setupOutgoing = function(outgoing, options, req, forward) {
extend(outgoing.headers, options.headers);
}

if(options.auth){
outgoing.auth = options.auth;
}

if (isSSL.test(options[forward || 'target'].protocol)) {
outgoing.rejectUnauthorized = (typeof options.secure === "undefined") ? true : options.secure;
}
Expand Down

0 comments on commit ab5c3e5

Please sign in to comment.