Skip to content

Add X-Accel-Buffering: no Header for SSE Responses #293

@pangpangDaddy

Description

@pangpangDaddy

Quick Search Confirmation

I searched existing issues in this repository and did not find a duplicate request for adding X-Accel-Buffering headers to SSE responses.

Expected Behavior

When using the spring-ai-starter-mcp-server-webmvc module to handle Server-Sent Events (SSE), the framework should automatically inject the header X-Accel-Buffering: no into all SSE responses. This ensures proxy servers (e.g., Nginx) disable response buffering, allowing real-time streaming of AI-generated content (e.g., chat completions, streaming predictions) without latency.

Example of Expected Headers:
For an SSE endpoint like /stream, the response should include:

Content-Type: text/event-stream
X-Accel-Buffering: no

Current Behavior

  • Missing Header: SSE responses from spring-ai-starter-mcp-server-webmvc do not include X-Accel-Buffering: no.
  • Consequence: Proxy servers (e.g., Nginx) buffer SSE responses by default, causing:
    • Delayed delivery of real-time data (e.g., chat messages appear in batches instead of streaming).
    • Inconsistent behavior in AI applications where low latency is critical.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Moderate issues affecting some users, edge cases, potentially valuable featurearea/serverenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions