Embed into a website iframe

Hello, i’m hosting grafana on windows and i have some difficulties to put it in an iframe. i modify my custom.ini file and set anonynous_access = true, cookie_samesite = none, allow_embedding = true. then i generate a share link: domain:300/dashboard… and it working fine in a browser but when i put it in a iframe, it isn’t working.
but when i was on localhost it was working in the iframe.

does somebody have an idea ?

Hi, Check is there CORS issue in your browser?

Hi,

no i’v check and there’s no CORS error in my browser. I’v installed a plugin in chrome to allow and test CORS it but there’s nothing in my iframe. i’v tested it on firefox too.

The website is handle by WIX.com (creating website) and the iframe ask for a https link or iframe code with https link in it. can it be the error ? But the iframe was working with the http:community.grafana.com which was http link. If the http/https is the problem, how can i convert my grafana link to https ?

Put a reverse proxy in front of Grafana.

i just put a reverse proxy with Nginx in front of Grafana and it work when i access it in the browser but still not in a iframe. i still have an http link, maybe this is my problem since the iframe required a HTTPS link. If so, can someone guide me throw the porcess to convert my http link to a https ?

Thank you for all your help by the way :slight_smile:

Configure the reverse proxy for HTTPS, that was the entire reason I suggested that. For a working example here’s my config for Apache 2.4:

<VirtualHost _default_:80>
  Alias /.well-known/acme-challenge /usr/local/www/dehydrated
  <Directory /usr/local/www/dehydrated>
    Options None
    AllowOverride None
    Require all granted
  </Directory>

  RewriteEngine On
  RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge
  RewriteRule (.+) https://%{HTTP_HOST}$1 [L,R=301]
</VirtualHost>

# https://grafana.com/docs/grafana/latest/installation/behind_proxy/
<VirtualHost *:443>
  ServerName grafana.mydomain.com

  ProxyRequests Off
  ProxyPreserveHost On
    
  <Proxy *>
    Require all granted
  </Proxy>

  <Location />
    Require all granted
  </Location>

  ProxyPass / http://192.168.x.y:3000/ 
  ProxyPassReverse / http://192.168.x.y:3000/ 

  SSLEngine on
  SSLCertificateFile "/usr/local/etc/dehydrated/certs/grafana.mydomain.com/cert.pem"
  SSLCertificateChainFile "/usr/local/etc/dehydrated/certs/grafanamydomain.com/chain.pem"
  SSLCertificateKeyFile "/usr/local/etc/dehydrated/certs/grafana.mydomain.com/privkey.pem"
</VirtualHost>