From 6e5f5e311ead9de02c96c44e071947ab273b1f59 Mon Sep 17 00:00:00 2001 From: WeidiDeng Date: Fri, 3 Jan 2025 01:49:33 +0800 Subject: [PATCH] remove deadline when fallback route is chosen (#282) --- layer4/routes.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/layer4/routes.go b/layer4/routes.go index b8ac942..24f8cec 100644 --- a/layer4/routes.go +++ b/layer4/routes.go @@ -221,6 +221,12 @@ func (routes RouteList) Compile(logger *zap.Logger, matchingTimeout time.Duratio matcherNeedMore = true goto loop } + // fallback route, removing deadline + // see: https://github.com/mholt/caddy-l4/issues/274 + err = cx.Conn.SetReadDeadline(time.Time{}) + if err != nil { + return err + } return next.Handle(cx) } })