diff --git a/server/handlers/api/alerts.py b/server/handlers/api/alerts.py index 99ed286..8e53bc1 100644 --- a/server/handlers/api/alerts.py +++ b/server/handlers/api/alerts.py @@ -53,6 +53,11 @@ class APIAlertsStreamHandler(tornado_eventsource.handler.EventSourceHandler): self.sse_alert_queues = sse_alert_queues self.web_server_metrics = web_server_metrics + # Custom headers to avoid e.g. nginx reverse proxy from buffering SSE data + def custom_headers(self): + return {"Cache-Control": "no-store", + "X-Accel-Buffering": "no"} + def open(self): try: # Metrics diff --git a/server/handlers/api/spots.py b/server/handlers/api/spots.py index 37b8423..209f517 100644 --- a/server/handlers/api/spots.py +++ b/server/handlers/api/spots.py @@ -54,6 +54,11 @@ class APISpotsStreamHandler(tornado_eventsource.handler.EventSourceHandler): self.sse_spot_queues = sse_spot_queues self.web_server_metrics = web_server_metrics + # Custom headers to avoid e.g. nginx reverse proxy from buffering SSE data + def custom_headers(self): + return {"Cache-Control": "no-store", + "X-Accel-Buffering": "no"} + # Called once on the client opening a connection, set things up def open(self): try: