Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

run-grafana-behind-a-proxy NGINX config #187

Open
@Andrey-Svetlichny

Description

@Andrey-Svetlichny

Please fix mistake in this page

WebSocket connection to 'ws://my-domain.org/api/datasources/proxy/1/loki/api/v1/tail?query=%7Bjob%3D%22api%22%7D' failed: 

To have "Live" mode working, NGINX config should be:

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

upstream grafana {
  server localhost:3000;
}

server {
    listen 80;
    listen [::]:80;
    server_name <your_server_name>;

    location / {
        proxy_set_header Host $http_host;
        proxy_pass http://grafana;
    }

    # Proxy Grafana Live WebSocket connections.
    location ~ ^/api/(live|datasources)/ {
        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://grafana;
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions