grafana: proxy websockets
If you watch the web console of your browser in a grafana page, it constantly tries to hit /api/live/ws which is currently giving an error. Following some combination of [1], [2], [3] and some trial-and-error, this appears to let apache proxy through the requests. [1] https://github.com/grafana/grafana/issues/36929 [2] https://github.com/grafana/grafana/issues/34537 [3] https://grafana.com/tutorials/run-grafana-behind-a-proxy/ Change-Id: I6c5ba71a1c0feab36b4df56f80271fa52f6354de
This commit is contained in:
parent
c43289b75a
commit
7745bf16f3
@ -8,6 +8,7 @@ services:
|
||||
image: docker.io/grafana/grafana-oss:latest
|
||||
network_mode: host
|
||||
environment:
|
||||
GF_SERVER_DOMAIN: 'grafana.opendev.org'
|
||||
GF_SECURITY_ADMIN_PASSWORD__FILE: '/etc/grafana/secrets/admin_password'
|
||||
GF_SECURITY_ADMIN_USER__FILE: '/etc/grafana/secrets/admin_user'
|
||||
GF_SECURITY_SECRET_KEY__FILE: '/etc/grafana/secrets/secret_key'
|
||||
|
@ -1,5 +1,7 @@
|
||||
<VirtualHost *:80>
|
||||
ServerName {{ inventory_hostname }}
|
||||
ServerAlias grafana.opendev.org
|
||||
|
||||
ServerAdmin webmaster@openstack.org
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/grafana-error.log
|
||||
@ -14,6 +16,8 @@
|
||||
|
||||
<VirtualHost *:443>
|
||||
ServerName {{ inventory_hostname }}
|
||||
ServerAlias grafana.opendev.org
|
||||
|
||||
ServerAdmin webmaster@openstack.org
|
||||
|
||||
AllowEncodedSlashes On
|
||||
@ -44,6 +48,11 @@
|
||||
RewriteEngine on
|
||||
RewriteRule "^/api/snapshots(.*?)$" "-" [F]
|
||||
|
||||
# This is for the websocket endpoint /api/live/ws
|
||||
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
||||
RewriteCond %{HTTP:Connection} upgrade [NC]
|
||||
RewriteRule ^/?(.*) "ws://localhost:3000/$1" [P,L]
|
||||
|
||||
ProxyPass / http://localhost:3000/ retry=0
|
||||
ProxyPassReverse / http://localhost:3000/
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user