Hello, I’m trying to embed Grafana dashboard in my webpage via CURL.
Grafana version: v7.1.0-beta3 (a3a9ce7f24)
HTTP server version: Apache 2.4
My server IP: 192.168.0.100
Grafana’s server IP: 192.168.33.56
<?php $ch = curl_init(); $authorization = "Authorization: Bearer <API_KEY>"; curl_setopt_array( $ch, array( CURLOPT_URL => 'http://192.168.33.56:3000/d/66d37d639b/dashboard_name?orgId=1', CURLOPT_HTTPHEADER => array('Content-Type: application/json' , $authorization), CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPAUTH => "HTTP/1.1" )); $output = curl_exec($ch); echo $output; ?>
Unfortunately this cannot be done because I’m getting a lot of 404 errors, for example:
As you can see it’s trying to load resource from my server, not Grafana’s server.
I’m getting info:
If you're seeing this Grafana has failed to load its application files 1. This could be caused by your reverse proxy settings. 2. If you host grafana under subpath make sure your grafana.ini root_url setting includes subpath 3. If you have a local dev build make sure you build frontend using: yarn start, yarn start:hot, or yarn build 4. Sometimes restarting grafana-server can help
I have no problem with CORS because of Apache 2.4 configuration:
<Directory /usr/share> AllowOverride None Require all granted Header set Access-Control-Allow-Origin "http://192.168.33.56:3000" Header set Access-Control-Allow-Methods "GET, OPTIONS" Header set Access-Control-Allow-Headers "origin, authorization, accept" Header set Access-Control-Allow-Credentials true </Directory>