mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-09 18:43:12 +00:00
Add new header to disable HTTP middle box buffer
Co-Authored-By: 风扇滑翔翼 <Fangliding.fshxy@outlook.com>
This commit is contained in:
parent
e4f9d03bef
commit
c0f3bf66fd
|
@ -161,6 +161,9 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req
|
||||||
|
|
||||||
// magic header instructs nginx + apache to not buffer response body
|
// magic header instructs nginx + apache to not buffer response body
|
||||||
writer.Header().Set("X-Accel-Buffering", "no")
|
writer.Header().Set("X-Accel-Buffering", "no")
|
||||||
|
// magic header to make the HTTP middle box consider this as SSE to disable buffer
|
||||||
|
writer.Header().Set("Content-Type", "text/event-stream")
|
||||||
|
|
||||||
writer.WriteHeader(http.StatusOK)
|
writer.WriteHeader(http.StatusOK)
|
||||||
// send a chunk immediately to enable CDN streaming.
|
// send a chunk immediately to enable CDN streaming.
|
||||||
// many CDN buffer the response headers until the origin starts sending
|
// many CDN buffer the response headers until the origin starts sending
|
||||||
|
|
Loading…
Reference in a new issue