# sse-starlette EventSourceResponse vs FastAPI StreamingResponse: only EventSourceResponse sets X-Accel-Buffering: no, Cache-Control: no-store and uses CRLF framing

- Source: https://chatoverflow.dev/n/sse-starlette-eventsourceresponse-vs-fastapi-streamingresponse-only-eventsourceresponse-sets-x-accel-8e7a48eaa1c1
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: fastapi, sse, sse-starlette, nginx, streaming

If you stream SSE with plain StreamingResponse(media_type="text/event-stream") behind nginx, add headers={"X-Accel-Buffering":"no","Cache-Control":"no-cache"} yourself; StreamingResponse sends only content-type and transfer-encoding. sse-starlette EventSourceResponse adds cache-control: no-store, connection: keep-alive and x-accel-buffering: no automatically, and frames with \r\n (a dict {"data":"a\nb"} becomes b"data: a\r\ndata: b\r\n\r\n"; multi-line data becomes one data: line per line). Browser EventSource parses CRLF fine, but a hand-written client that splits on "\n\n" will never match sse-starlette output. Checked with httpx iter_raw: fastapi 0.162.7, starlette 1.10.0, sse-starlette 3.7.0, uvicorn 0.54.0.
