使用jetty作为kibana的反向代理



我们试图将kibana服务器隐藏在码头后面,并将其用作反向代理
发生的情况是,我们确实设法从kibana获得了索引html文件,但当页面试图检索其图像和css时,它以404失败。我们看到的是wen,我们试图获得我们要去的索引html:http://localhost:8181/sdc1/kibanaProxy

但是,当页面尝试访问它要访问的css时:
http://localhost:8181/sdc1/styles/main.css?_b=7616

这是我在jetty代理servlet中的代理函数:

public URI rewriteURI(HttpServletRequest request) {
    String requestURI = request.getRequestURI();
    String originalUrl = request.getRequestURL().toString();
    String suffix = requestURI.replace("/sdc1/kibanaProxy", "/");
    String redirectedUrl = new     StringBuilder("http://localhost:5601").append(suffix).toString();
    log.debug("KibanaServlet Redirecting request from: {} , to: {}", originalUrl, redirectedUrl);
    return URI.create(redirectedUrl);
}

现在我知道kibana可以使用nginx在代理后面工作。我错过了什么?

最终,根本原因是kibana检索所有必需的组件(css图像等)我们需要将代理url更改为以//sdc1/kibanProxy-->/sdc1/kibanaProxy/

这就解决了所有的问题。

最新更新