From d3842ec3c3e3dcd4ea7e0370b51a984e6d9427dd Mon Sep 17 00:00:00 2001 From: yusing Date: Thu, 28 Nov 2024 07:15:27 +0800 Subject: [PATCH] fixed loadbalancer panic --- internal/route/http.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/route/http.go b/internal/route/http.go index 614a18f..d470b51 100755 --- a/internal/route/http.go +++ b/internal/route/http.go @@ -145,8 +145,9 @@ func (r *HTTPRoute) ServeHTTP(w http.ResponseWriter, req *http.Request) { func (r *HTTPRoute) addToLoadBalancer() { var lb *loadbalancer.LoadBalancer l, ok := routes.GetHTTPRoute(r.LoadBalance.Link) - linked := l.(*HTTPRoute) + var linked *HTTPRoute if ok { + linked = l.(*HTTPRoute) lb = linked.loadBalancer lb.UpdateConfigIfNeeded(r.LoadBalance) if linked.Raw.Homepage == nil && r.Raw.Homepage != nil {