Allow-same-origin

  • I am using Grafana 9.1.2 version on Ubuntu 22.04 operating system.

  • I am trying to achieve embed a panel from the dashboard into the Power BI.

  • I have enabled all the required configurations to make iframe embedding available and it works perfectly fine on an HTML static page. But then I encountered the CORS issue when I integrated Power BI with the Grafana dashboard panel which is also resolved by running Grafana behind a reverse proxy using Nginx.

  • Now, I am facing Failed to read the ‘cookie’ property from ‘Document’: The document is sandboxed and lacks the ‘allow-same-origin’ flag.

  • This was working fine as I have successfully embedded my company website URL in Power BI’s iframe.

  • the configuration(s):

grafana
allow_embedding = true
enabled = true
org_name = Kube Network
org_role = Viewer
hide_version = true

nginx
server {
listen 443;
ssl on;
ssl_certificate /etc/grafana/abc.crt;
ssl_certificate_key /etc/grafana/def.key;
server_name monitoring.*****.net;
listen 80;
access_log /var/log/nginx/grafana.log;

    location / {

            add_header  Access-Control-Allow-Origin "*";
            add_header  "Access-Control-Allow-Credentials" "true";
            add_header  "Access-Control-Allow-Methods" "GET, POST, OPTIONS";
            add_header  "Access-Control-Allow-Headers" "Authorization, origin, accept";

            proxy_pass http://grafana.staged-by-discourse.com;
            proxy_set_header Host $http_host;
            proxy_set_header X-Forwarded-Host $host:$server_port;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

}

  • Not showing any error in Grafana logs nor Nginx logs. But I caught this error in the Power BI web interface in Chrome. Does anyone have any clue what is going on in my scenario?


That looks like samesite cookie config problem Configure Grafana | Grafana documentation

Or used CSP policy blocks some access.

@jangaraj thanks for your reply. I tried this solution but unfortunately it didn’t work. I have also attached a snapshot of the error that appears in the Power BI desktop and web interface.

Sorry, it is not clear what did you try. samesite has multiple possible values and CSP many variations, which gives you a million combinations. Did you really try all of them?

  • also PowerBi CSP may be in a place.

@jangaraj I have made the changes in Grafana using SamSite with a value of 4 and CSP with a value of two but the result did not change.
Additionally, I would also like to mention that I have managed to embed two blog sites in PowerBI successfully but Grafana’s panel embedding in PowerBI gives an error as shown in the image.
I’ve also embedded Grafana’s panel with a static HTML page and it works fine. But didn’t work with PowerBI.
Unfortunately, I could not find the CSP setting in the PowerBI dashboard and web interface. I haven’t found a solution yet.

Why do you want to embed grafana in powerbi? Missing functionality?

Any specific plugin you are trying to showcase in powerbi?

We are trying to move away from powerbi to grafana

In my own experience with pbi, seems bulky, very hard to manage vs grafana.

We are making the cutoff soon

@yosiasz I am using the free version of Grafana Enterprise and it does not have the PDF reporting feature. An enterprise license is very expensive for a small-scale company. So, my company wants to use Power BI for front-end user and embed important graphs in Power BI.
I will forward your answer to my team for Importance of Grafana on Power BI.
But right now I have to get it and I’ve been struggling to do it since Friday.

1 Like