diff --git a/core/corehttp/gateway_handler.go b/core/corehttp/gateway_handler.go index ebf0b3c6e..ca7938346 100644 --- a/core/corehttp/gateway_handler.go +++ b/core/corehttp/gateway_handler.go @@ -114,9 +114,10 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request defer cancel() if cn, ok := w.(http.CloseNotifier); ok { + clientGone := cn.CloseNotify() go func() { select { - case <-cn.CloseNotify(): + case <-clientGone: case <-ctx.Done(): } cancel()