SplitHTTP server: Add "Cache-Control: no-store" to GET response (#3652)

https://github.com/XTLS/Xray-core/pull/3652#issuecomment-2282308407
This commit is contained in:
Lumière Élevé 2024-08-11 00:59:42 +01:00 committed by GitHub
parent 513182adf3
commit 0c7303960a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -184,6 +184,10 @@ 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")
// A web-compliant header telling all middleboxes to disable caching.
// Should be able to prevent overloading the cache, or stop CDNs from
// teeing the response stream into their cache, causing slowdowns.
writer.Header().Set("Cache-Control", "no-store")
if !h.config.NoSSEHeader { if !h.config.NoSSEHeader {
// magic header to make the HTTP middle box consider this as SSE to disable buffer // magic header to make the HTTP middle box consider this as SSE to disable buffer
writer.Header().Set("Content-Type", "text/event-stream") writer.Header().Set("Content-Type", "text/event-stream")