kibana server.basePath结果为404 [英] kibana server.basePath results in 404

查看:2093
本文介绍了kibana server.basePath结果为404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在RHEL 7.2上运行kibana 4.4.1

I am running kibana 4.4.1 on RHEL 7.2

当kibana.yml文件不包含设置server.basePath时,一切正常. Kibana成功启动并发出消息

Everything works when the kibana.yml file does not contain the setting server.basePath. Kibana successfully starts and spits out the message

[info][listening] Server running at http://x.x.x.x:5601/

curl http://x.x.x.x:5601/app/kibana返回预期的HTML.

curl http://x.x.x.x:5601/app/kibana returns the expected HTML.

但是,当basePath设置为server.basePath: "/kibana4"时, http://xxxx:5601/kibana4/app /kibana 的结果为404.为什么?

However, when basePath is set to server.basePath: "/kibana4", http://x.x.x.x:5601/kibana4/app/kibana results in a 404. Why?

服务器以相同的日志记录成功启动

The server successfully starts with the same logging

[info][listening] Server running at http://x.x.x.x:5601/

但是

curl http://x.x.x.x:5601/返回

<script>
  var hashRoute = '/kibana4/app/kibana';
  var defaultRoute = '/kibana4/app/kibana';
  ...
</script>

curl http://x.x.x.x:5601/kibana4/app/kibana返回 {"statusCode":404,"error":"Not Found"}

curl http://x.x.x.x:5601/kibana4/app/kibana returns {"statusCode":404,"error":"Not Found"}

为什么'/kibana4/app/kibana'返回404?

Why does '/kibana4/app/kibana' return a 404?

推荐答案

server.basePath的行为不符合我的预期.

server.basePath does not behave as I expected.

我期望server.basePath对称地影响URL.这意味着请求URL将在/kibana4子域下,响应URL也将在/kibana4子域下.

I was expecting server.basePath to symmetrically affect the URL. Meaning that request URLs would be under the subdomain /kibana4 and response URLs would also be under the subdomain /kibana4.

情况并非如此. server.basePath不对称地影响URL.这意味着所有请求URL都保持不变,但响应URL包含了子域.例如,仍然可以在 http://xxxx:5601/app/kibana 上访问kibana主页.但所有hrefs URL都包含/kibana4子域.

This is not the case. server.basePath asymetrically affects the URL. Meaning that all request URLs remain the same but response URLs have included the subdomin. For example, the kibana home page is still accessed at http://x.x.x.x:5601/app/kibana but all hrefs URLs include the subdomain /kibana4.

server.basePath仅在以下情况下有效:将代理转发到kibana之前,该代理使用了删除子域的代理

server.basePath only works if you use a proxy that removes the subdomain before forwarding requests to kibana

下面是我使用的HAProxy配置

Below is the HAProxy configuration that I used

frontend main *:80
   acl url_kibana   path_beg   -i /kibana4
   use_backend kibana   if url_kibana

backend kibana
   mode http
   reqrep ^([^\ ]*)\ /kibana4[/]?(.*) \1\ /\2\
   server x.x.x.x:5601

重要的一点是reqrep表达式,该表达式在将请求转发到kibana之前从URL删除了子域/kibana4.

The important bit is the reqrep expression that removes the subdomain /kibana4 from the URL before forwarding the request to kibana.

这篇关于kibana server.basePath结果为404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆