kibana内嵌iframe到web应用中
Posted muzizongheng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了kibana内嵌iframe到web应用中相关的知识,希望对你有一定的参考价值。
kibana支持dashboard内嵌到我们自己的web前端中, 1.点击kibana的dashboard 2.点击“share" 标签页 3. 4.把上面代码内嵌到我们的html节点中即可 <!DOCTYPE html> <html> <style type="text/css"> html, body margin: 0; padding 0; width: 100%; height: 100%; iframe border: 0; width: 100%; height: 99%; </style> <script language='javascript' type='text/javascript'> Hello World! </script> <body> <iframe src=" http://localhost:81/elk/app/kibana#/dashboard/4462e850-54fa-11e8-ba6a-d3c48cdae39b?embed=true&_g=(refreshInterval%3A ('%24%24hashKey'%3A'object%3A1084'%2Cdisplay%3A'2%20hour'%2Cpause%3A!f%2Csection%3A3%2Cvalue%3A7200000)%2Ctime%3A(from%3Anow-30m%2Cinterval%3A'1m'%2Cmode%3Aquick%2Ctimezone%3AAsia%2FShanghai%2Cto%3Anow))" height="600" width="800" ></iframe> </body> </html> 5.需要注意的是好多web服务器, 比如apache默认是不允许跨域访问 6.打开apache的http.conf配置文件, 搜索X-Frame-Options <IfModule headers_module> <IfVersion >= 2.4.7 > Header always setifempty X-Frame-Options SAMEORIGIN </IfVersion> <IfVersion < 2.4.7 > Header always merge X-Frame-Options SAMEORIGIN </IfVersion> RequestHeader unset Proxy </IfModule> 7.修改 SAMEORIGIN为ALLOW-FROM , 或者把setifempty改为 unset <IfModule headers_module> <IfVersion >= 2.4.7 > #Header always setifempty X-Frame-Options ALLOW-FROM http://localhost Header always unset X-Frame-Options </IfVersion> <IfVersion < 2.4.7 > #Header always merge X-Frame-Options ALLOW-FROM http://localhost Header always unset X-Frame-Options </IfVersion> RequestHeader unset Proxy </IfModule>以上是关于kibana内嵌iframe到web应用中的主要内容,如果未能解决你的问题,请参考以下文章