fix(server): send SSE-friendly headers on /hyper/events#35
Closed
jtlocsei wants to merge 1 commit into
Closed
Conversation
Prevent reverse proxies such as NGINX and OpenResty from buffering or transforming Hyper's SSE stream. In some managed hosting setups, that can delay SSE patches and leave the UI stuck in transient states even though the underlying action has already completed. Send Cache-Control: no-cache, no-transform and X-Accel-Buffering: no with Hyper's built-in /hyper/events response so SSE behaves reliably behind those proxies while preserving the existing Brotli behavior.
83ba40a to
7bdeacc
Compare
Contributor
|
Merged, thanks! |
alekseysotnikov
pushed a commit
to alekseysotnikov/hyper
that referenced
this pull request
May 4, 2026
Closes dynamic-alpha#35 Prevent reverse proxies such as NGINX and OpenResty from buffering or transforming Hyper's SSE stream. In some managed hosting setups, that can delay SSE patches and leave the UI stuck in transient states even though the underlying action has already completed. Send Cache-Control: no-cache, no-transform and X-Accel-Buffering: no with Hyper's built-in /hyper/events response so SSE behaves reliably behind those proxies while preserving the existing Brotli behavior. (cherry picked from commit f49074c) # Conflicts: # src/hyper/server.clj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add SSE-friendly response headers to Hyper's built-in
/hyper/eventsendpoint:
Cache-Control: no-cache, no-transformX-Accel-Buffering: noWhy
Some Hyper deployments sit behind reverse proxies such as NGINX or
OpenResty. Those proxies can buffer or transform
text/event-streamresponses, which delays SSE delivery and can leave the browser UI stuck
in transient states even though the server-side action has already
completed.
These headers improved that behaviour in a managed hosting deployment
without requiring app-specific configuration or disabling Brotli.
Notes
Cache-Control: no-cache, no-transformis appropriate for a live SSE stream.X-Accel-Buffering: nois useful for NGINX/OpenResty and is generally harmless elsewhere.Content-TypeandContent-Encodingremain under Hyper's control.Testing
Add a focused test covering the initial SSE response headers with and
without Brotli compression.