forked from mtusi2026/mtusi2026lab7
fix(tls): flush early API responses before request body teardown
This commit is contained in:
@@ -361,6 +361,11 @@ func (l *boundedListener) Accept() (net.Conn, error) {
|
||||
}
|
||||
func loopbackProxy(c Config, target *url.URL) *httputil.ReverseProxy {
|
||||
proxy := httputil.NewSingleHostReverseProxy(target)
|
||||
if c.Role == "api" {
|
||||
// Deliver the application's early error before request-body teardown.
|
||||
// Otherwise a large upload can close the hop before buffered JSON drains.
|
||||
proxy.FlushInterval = -1
|
||||
}
|
||||
director := proxy.Director
|
||||
proxy.Director = func(r *http.Request) {
|
||||
director(r)
|
||||
|
||||
Reference in New Issue
Block a user