From 1e6eccccb3d8c726f8526f380a8cb9494b9ba6b9 Mon Sep 17 00:00:00 2001
From: Kristian Klausen <kristian@klausen.dk>
Date: Tue, 15 Feb 2022 20:54:13 +0100
Subject: [PATCH] grafana: Set the Host header to account for CSRF changes[1]
 in v8.3.5

Without this fix all the Prometheus dashboards failed loading data with:
"Error updating options: origin not allowed".

[1] https://github.com/grafana/grafana/issues/45117#issuecomment-1033842787
---
 roles/grafana/templates/nginx.d.conf.j2 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/roles/grafana/templates/nginx.d.conf.j2 b/roles/grafana/templates/nginx.d.conf.j2
index 20ee1c031..ec628efd0 100644
--- a/roles/grafana/templates/nginx.d.conf.j2
+++ b/roles/grafana/templates/nginx.d.conf.j2
@@ -41,6 +41,7 @@ server {
 
 {% set proxy -%}
         proxy_pass http://grafana;
+        proxy_set_header Host $host;
         proxy_set_header X-Forwarded-For      $remote_addr;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection $connection_upgrade;
-- 
GitLab