mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[elasticsearch/proxy] use different code path with erorr
This commit is contained in:
parent
e100e1f5c9
commit
fec5e1a2dc
1 changed files with 10 additions and 7 deletions
|
@ -20,14 +20,17 @@ function createProxy(server, method, route, config) {
|
|||
xforward: true,
|
||||
timeout: server.config().get('elasticsearch.requestTimeout'),
|
||||
onResponse: function (err, responseFromUpstream, request, reply) {
|
||||
const upstreamLocation = responseFromUpstream.headers.location;
|
||||
const response = reply(err, responseFromUpstream);
|
||||
|
||||
// Workaround for #8705 until hapi has been updated to >= 15.0.0
|
||||
if (upstreamLocation) {
|
||||
delete responseFromUpstream.headers.location;
|
||||
response.location(encodeURI(upstreamLocation));
|
||||
if (err) {
|
||||
reply(err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (responseFromUpstream.headers.location) {
|
||||
// TODO: Workaround for #8705 until hapi has been updated to >= 15.0.0
|
||||
responseFromUpstream.headers.location = encodeURI(responseFromUpstream.headers.location);
|
||||
}
|
||||
|
||||
reply(null, responseFromUpstream);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue