部署granfana使用nginx反向代理之后,使用本机localhost登录可以正常显示图标数据,使用域名访问会出现Origin not allowed,原因是因为跨域的问题出现无法访问。
解决办法:
在nginx代理中添加
proxy_set_header Host $http_host;
整体配置:
location /grafana {
proxy_pass http://127.0.0.1:3000/grafana;
proxy_set_header Host $http_host;
}
这里需要注意的是,如果在路径中带有其他参数,比如/grafana 那么需要在grafana的配置文件中进行调整root_url相关信息;
默认的root_url是:
root_url = %(protocol)s://%(domain)s:%(http_port)s/
官网文档如下: