Skip to content

fix(server): correct SSE Content-Type header (text/readystream → text/event-stream)#2128

Open
xb17 wants to merge 1 commit into
danielmiessler:mainfrom
xb17:fix/sse-content-type
Open

fix(server): correct SSE Content-Type header (text/readystream → text/event-stream)#2128
xb17 wants to merge 1 commit into
danielmiessler:mainfrom
xb17:fix/sse-content-type

Conversation

@xb17
Copy link
Copy Markdown

@xb17 xb17 commented May 28, 2026

What

The /chat SSE endpoint sets Content-Type: text/readystream, which is not a valid MIME type.

Why it matters

Strict SSE clients — including browser EventSource, Tauri WebView2, and some reverse proxies — check the Content-Type header before parsing the stream. An invalid type causes them to treat the response as a plain HTTP body rather than an event stream, breaking streaming entirely for those clients.

The correct MIME type for Server-Sent Events is text/event-stream (per the WHATWG SSE spec).

This also removes a hardcoded Access-Control-Allow-Origin: http://localhost:5173 header on the same handler, which has no effect in production and points to a specific dev-server port.

Change

internal/server/chat.go — one-line fix to the Content-Type string, remove stale CORS header.

…vent-stream

text/readystream is not a valid MIME type. Strict SSE clients (browser
EventSource, WebView2, some proxies) require the correct text/event-stream
type to parse the stream. Also removes a hardcoded Access-Control-Allow-Origin
header pointing to a specific dev port, which has no effect in production.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant