Skip to content

feat: add new plugin sse to support Server-Sent Events (SSE) #12498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

billmoling
Copy link

Description

Motivation

This PR introduces a new sse plugin for Apache APISIX that enables support for Server-Sent Events (SSE), a mechanism for servers to push updates to the browser over a long-lived HTTP connection.

SSE requires specific proxy settings and headers to ensure streaming behavior works reliably, which are not enabled by default in APISIX. This plugin configures those behaviors for routes or services that serve SSE.

Features

  • ✅ Disables response buffering and request buffering to allow real-time data delivery from upstream.
  • ✅ Sets a long proxy_read_timeout to prevent SSE connections from being cut off.
  • ✅ Sets essential response headers:
    • Content-Type: text/event-stream; charset=utf-8
    • Cache-Control
    • Connection
    • X-Accel-Buffering
  • ✅ Supports configuration of proxy_read_timeout, cache_control, and connection_header.
  • ✅ Provides optional override of the Content-Type header (enabled by default).
  • ✅ Adds debug-level logs to help with observability.

Which issue(s) this PR fixes:

Fixes #10030 #10204

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. plugin labels Aug 7, 2025
@SkyeYoung
Copy link
Member

Please fix the errors reported by CI.

@billmoling billmoling marked this pull request as draft August 7, 2025 04:30
@billmoling billmoling marked this pull request as ready for review August 7, 2025 04:36
@billmoling
Copy link
Author

Please fix the errors reported by CI.

I fixed the issue from last build. could you please approve another CI build?

@SkyeYoung
Copy link
Member

@billmoling billmoling marked this pull request as draft August 9, 2025 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: does apisix support sse at now
2 participants