From f279f8ae05c207d7d304b5592a7eb1bc5216d401 Mon Sep 17 00:00:00 2001 From: efim Date: Sun, 26 Nov 2023 04:51:08 +0000 Subject: [PATCH] fix: nginx sse in reverse proxy --- flake.nix | 5 +++++ routes/room_page.go | 1 + 2 files changed, 6 insertions(+) diff --git a/flake.nix b/flake.nix index ef0826d..c7b8b9c 100644 --- a/flake.nix +++ b/flake.nix @@ -110,6 +110,11 @@ locations."/" = { proxyPass = "http://127.0.0.1:${toString cfg.port}"; }; + extraConfig = '' + # check http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive + proxy_set_header Connection ""; + proxy_http_version 1.1; + ''; }; }; services.redis.servers.${pname} = { diff --git a/routes/room_page.go b/routes/room_page.go index e1243d9..efd805a 100644 --- a/routes/room_page.go +++ b/routes/room_page.go @@ -70,6 +70,7 @@ func streamingRoomStates( w.Header().Set("Cache-Control", "no-cache") w.Header().Set("Connection", "keep-alive") w.Header().Set("Content-Type", "text/event-stream") + w.Header().Set("X-Accel-Buffering", "no") templFile := "templates/room.gohtml" tableTemplates := "templates/tableTemplates.gohtml"