mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 08:56:43 -06:00
Docs: Add NGINX example for using websockets to Loki (#27998)
* feat: added NGINX example for using websockets to Loki * chore: corrections after review * chore: more correrctions from review * chore: creview corrections * chore: addressed review comment by @achatterjee-grafana
This commit is contained in:
parent
97262fb8fc
commit
d378240c4b
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user