mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Forwarding the headers
This commit is contained in:
parent
5fa8105ec5
commit
598a1b4419
1 changed files with 3 additions and 9 deletions
|
@ -40,9 +40,9 @@ router.use(function (req, res, next) {
|
|||
|
||||
var uri = _.defaults({}, target);
|
||||
var options = {
|
||||
url: uri.protocol + '//' + uri.host + req.path,
|
||||
url: uri.protocol + '//' + uri.host + req.url,
|
||||
method: req.method,
|
||||
headers: { },
|
||||
headers: _.defaults({ host: target.hostname }, req.headers),
|
||||
strictSSL: config.kibana.verify_ssl,
|
||||
timeout: config.kibana.request_timeout
|
||||
};
|
||||
|
@ -53,16 +53,10 @@ router.use(function (req, res, next) {
|
|||
}
|
||||
|
||||
// Only send the body if it's a PATCH, PUT, or POST
|
||||
if (_.contains(['PATCH', 'PUT', 'POST'], options.method) && req.rawBody) {
|
||||
if (req.rawBody) {
|
||||
options.body = req.rawBody;
|
||||
}
|
||||
|
||||
// If there is a query string we need to stringify it and send it with
|
||||
// the request
|
||||
if (Object.keys(req.query).length !== 0) {
|
||||
options.url += '?' + querystring.stringify(req.query);
|
||||
}
|
||||
|
||||
// Support for handling basic auth
|
||||
if (config.kibana.elasticsearch_username && config.kibana.elasticsearch_password) {
|
||||
var code = new buffer.Buffer(config.kibana.elasticsearch_username + ':' + config.kibana.elasticsearch_password);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue