上周 Grafana 工作沒(méi)有任何問(wèn)題,但更新到 8.3.5 后我無(wú)法再登錄。
在登錄屏幕中,輸入我的用戶(hù)名和密碼后,會(huì)出現(xiàn)一條消息:“Origin not allowed”。 在 grafana.log 文件中,我看到一行:
lvl=eror msg="無(wú)法根據(jù) cookie 查找用戶(hù)" logger=context error="未找到用戶(hù)令牌"
解決方案:
在nginx的conf.d文件中,有一個(gè)grafana.conf的文件,需要在配置文件中增加
proxy_set_header Host $http_host; //added after upgrade from 8.1 to 8.4.1 for origin not allowed error
但是發(fā)現(xiàn)還是不行,看到說(shuō)可以把$http_host改成自己的domain,于是嘗試下
proxy_set_header Host domain.com
最后重啟nginx
sudo systemctl restart nginx
sudo systemctl status nginx
然后刷新頁(yè)面,登錄,可以進(jìn)去了