0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-02-17 23:45:29 -05:00

Allow adding/overriding HTTP headers of uplinks via config

https://github.com/verdaccio/verdaccio/pull/67
This commit is contained in:
Jannis Achstetter 2016-10-05 12:56:03 +02:00 committed by trent.earl
parent 3729c13a91
commit 9f9c0fae71
2 changed files with 10 additions and 0 deletions

View file

@ -51,6 +51,11 @@ uplinks:
# timeouts are defined in the same way as nginx, see:
# http://wiki.nginx.org/ConfigNotation
# add/override HTTP headers sent to the uplink server
# this allows for HTTP Basic auth for example:
#headers:
# authorization: "Basic YourBase64EncodedCredentials=="
packages:
# uncomment this for packages with "local-" prefix to be available
# for admin only, it's a recommended way of handling private packages

View file

@ -116,6 +116,11 @@ Storage.prototype.request = function(options, cb) {
headers['User-Agent'] = headers['User-Agent'] || this.userAgent
this._add_proxy_headers(options.req, headers)
// add/override headers specified in the config
for (var key in this.config.headers) {
headers[key] = this.config.headers[key]
}
var method = options.method || 'GET'
var uri = options.uri_full || (this.config.url + options.uri)