java - Kibana 启用了您当前浏览器不符合的严格安全要求
问题描述
我想编写自动测试来测试kibana UI中是否有日志,并且我在使用java向kibana发送http请求时遇到问题。从浏览器中一切正常,但是当我从 Jsoup 库发送 HTTP 请求时(curl 也会发生同样的情况),kibana 向我显示以下内容:
Please upgrade your browser This Elastic installation has strict
security requirements enabled that your current browser does not meet.
看起来 kibana 正在执行一些易受攻击的 js,如果执行正确,它将停止加载 kibana UI。
<script>
// Since this is an unsafe inline script, this code will not run
// in browsers that support content security policy(CSP). This is
// intentional as we check for the existence of __kbnCspNotEnforced__ in
// bootstrap.
window.__kbnCspNotEnforced__ = true;
</script>
<script src="/bundles/app/kibana/bootstrap.js"></script>
你知道如何从代码中解决这个问题吗?我认为可以从 kibana.yaml 禁用此安全功能,但我不想仅仅为了测试而禁用它。
解决方案
我放弃了这种自动测试,但我想在这里回答一种可能的解决方案(我没有测试它,但它应该可以工作)。
您可以使用无头 Chrome 浏览器。它运行的是没有 UI 的 chrome 浏览器,可以与使用 selenium 库的 chrome 驱动程序一起使用。更多信息:https ://www.scrapingbee.com/blog/introduction-to-chrome-headless/
推荐阅读
- html -
is not being displayed in the tab bar</h1> <div id="body"><p>I am a HTML beginner since we have just started working with it in school. I am encountering a problem at which i dont exactly know what I have done wrong. The line My - python-3.x - 评估函数在 x 上的导数的 Sympy 解决方案
- c++ - 包含多个 C 和 C++ 源文件的 mkoctfile
- php - 优化访问函数 laravel
- firebase - “click”事件处理程序中的错误:“ReferenceError:未定义用户”
- angular - 点击添加按钮不显示数据
- ef-core-2.1 - 如何使用 EF Core 定位 sql server 2008
- essbase - 有人可以解释以下 Essbase 代码:FIX,@relative
- java - 在 Java 中声明限制在指定范围内的变量
- c++ - 将变量传递给 PUGIXML xml_tree_walker