diff --git a/docs/sources/datasources/loki.md b/docs/sources/datasources/loki.md index ad97af98be5..d29189fd7fe 100644 --- a/docs/sources/datasources/loki.md +++ b/docs/sources/datasources/loki.md @@ -134,8 +134,37 @@ Note that Live Tailing relies on two Websocket connections: one between the brow ``` ProxyPassMatch "^/(api/datasources/proxy/\d+/loki/api/v1/tail)" "ws://127.0.0.1:3000/$1" ``` +The following example shows basic NGINX proxy configuration. It assumes that the Grafana server is available at `http://localhost:3000/`, Loki server is running locally without proxy, and your external site uses HTTPS. If you also host Loki behind NGINX proxy, then you might want to repeat the following configuration for Loki as well. -> **Note:** This feature is only available in Grafana v6.3+ +In the `http` section of NGINX configuration, add the following map definition: +``` + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } +``` +In your `server` section, add the following configuration: +``` + location ~ /(api/datasources/proxy/\d+/loki/api/v1/tail) { + proxy_pass http://localhost:3000$request_uri; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto "https"; + proxy_set_header Connection $connection_upgrade; + proxy_set_header Upgrade $http_upgrade; + } + + location / { + proxy_pass http://localhost:3000/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto "https"; + } +``` + +> **Note:** This feature is only available in Grafana v6.3+. ## Log Context