reverseproxy: make error chan bigger when reverse proxying websocket (#7419)

This commit is contained in:
WeidiDeng
2026-01-06 17:55:47 +08:00
committed by GitHub
parent 7b031e1eb5
commit 80f2ae92cd

View File

@@ -214,7 +214,10 @@ func (h *Handler) handleUpgradeResponse(logger *zap.Logger, wg *sync.WaitGroup,
timeoutc = timer.C
}
errc := make(chan error, 1)
// when a stream timeout is encountered, no error will be read from errc
// a buffer size of 2 will allow both the read and write goroutines to send the error and exit
// see: https://github.com/caddyserver/caddy/issues/7418
errc := make(chan error, 2)
wg.Add(2)
go spc.copyToBackend(errc)
go spc.copyFromBackend(errc)