This is a minimal reproduction case for the Server-Sent Events (SSE) compression issue in Traefik v3. The issue occurs when gzip compression is enabled and the server keeps the SSE connection open.
In Traefik v3, when gzip compression is enabled, SSE events are not delivered to the client until the server closes the connection. This differs from Traefik v2 behavior where events are delivered immediately, regardless of connection state.
The project consists of:
- A Node.js application that provides two SSE endpoints:
/events/keep-open- Server sends event and keeps connection open/events/auto-close- Server sends event and closes connection
- A web UI that demonstrates four scenarios:
- Traefik v2 with client-side close
- Traefik v2 with server-side close
- Traefik v3 with client-side close
- Traefik v3 with server-side close
- Docker Compose configuration running both Traefik versions side by side
- Start the stack:
docker compose up --build-
Open http://localhost:3000 in your browser to access the test UI through Traefik v2
-
Test different scenarios:
- Client-side Close: Server keeps connection open, client must close it
- Server-side Close: Server closes connection after sending event
- Both client-side and server-side close scenarios work correctly
- Events are delivered immediately
- Compression works without affecting event delivery
- Server-side close works correctly
- Client-side close scenario fails to deliver events until connection is closed
- This appears to be related to how Traefik v3 handles compression buffers with SSE
- Traefik v2 dashboard: http://localhost:8080
- Traefik v3 dashboard: http://localhost:8081
- Both Traefik instances have gzip compression enabled
- The Node.js server adds a 200ms delay before sending events to simulate real-world conditions
- The UI shows exact timestamps of events and connection states
- All scenarios use the same event payload size for consistent testing