nginx: disable gzip for SSE endpoints

Gzip buffers output by default to optimize compression. This buffering delays the transmission of
events—breaking the “real-time” feel of SSE. Instead of seeing each event instantly, the client
might see a batch of events all at once after the gzip buffer flushes (which could take seconds or more).

gzip_types is a whitelist . But certain modules like proxies can not honor it.
This commit is contained in:
Girish Ramakrishnan
2025-04-16 08:35:21 +02:00
parent 04ff495066
commit 51d1efead6

View File

@@ -131,8 +131,11 @@ server {
gzip_min_length 18k;
gzip_types text/css text/javascript text/xml text/plain application/javascript application/x-javascript application/json;
# enable for proxied requests as well
gzip_proxied any;
# compression chunking logic will interfere with SSE packet flushing
gzip_disable "text/event-stream";
# what responses are proxied
gzip_proxied no-cache no-store private expired auth;
<% if ( endpoint === 'dashboard' || endpoint === 'ip' || endpoint === 'setup' ) { -%>
# CSP headers for the dashboard resources