From 59af06e36af96acab86aec27fbdd4a001a1bfe34 Mon Sep 17 00:00:00 2001 From: Misi Date: Tue, 24 Sep 2024 19:53:29 +0200 Subject: [PATCH] Devenv: Add serve_from_sub_path scenario to nginx devenv (#93691) Setup serve_from_sub_path scenario with nginx --- .../nginx_serve_from_sub_path.conf | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 devenv/docker/blocks/auth/nginx_proxy/nginx_serve_from_sub_path.conf diff --git a/devenv/docker/blocks/auth/nginx_proxy/nginx_serve_from_sub_path.conf b/devenv/docker/blocks/auth/nginx_proxy/nginx_serve_from_sub_path.conf new file mode 100644 index 00000000000..5da5207657b --- /dev/null +++ b/devenv/docker/blocks/auth/nginx_proxy/nginx_serve_from_sub_path.conf @@ -0,0 +1,39 @@ +events { worker_connections 1024; } + +http { + # This is required to proxy Grafana Live WebSocket connections. + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + upstream grafana { + server host.docker.internal:3000; + } + + server { + listen 8090; + + location / { + root /var/www/html; + } + + # Set the followings in grafana.ini: + # [server] + # root_url = http://localhost:8090/grafana/ + # serve_from_sub_path = true + location /grafana/ { + proxy_set_header Host $host; + proxy_pass http://grafana; + } + + # Proxy Grafana Live WebSocket connections. + location /grafana/api/live/ { + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_set_header Host $host; + proxy_pass http://grafana; + } + } +} \ No newline at end of file