cloudspout / cloudspout-button-panel

Grafana panel to integrate with any kind of HTTP/REST API
MIT License
50 stars 35 forks source link

Failed to load resource: Origin domain.tld is not allowed by Access-Control-Allow-Origin. Status code: 200 #98

Open Marcwa19197 opened 1 year ago

Marcwa19197 commented 1 year ago

Hello, im always getting "Failed to load resource: Origin domain.tld is not allowed by Access-Control-Allow-Origin. Status code: 200" if i press the button and check the Network-Inspector in my Browser.

How can i fix this? Im using the following nginx config as reverse proxy:

# this is required to proxy Grafana Live WebSocket connections.
map $http_upgrade $connection_upgrade {
  default upgrade;
  '' close;
}

upstream domain.tld {
  server localhost:3000;
}

server {
  listen 80;
  root /usr/share/nginx/html;
  index index.html index.htm;

  location / {
#    proxy_set_header Host $http_host;
#    add_header 'Access-Control-Allow-Origin' '*' always;
#    proxy_pass http://domain.tld;
            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://localhost:3000;
            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;
  }

  # Proxy Grafana Live WebSocket connections.
  location /api/live/ {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_set_header Host $http_host;
    proxy_pass http://domain.tld;
  }
}
Marcwa19197 commented 1 year ago

no one? :-/