fix: conflict error on load-balanced and excluded routes

This commit is contained in:
yusing
2025-06-05 01:16:53 +08:00
parent 44ef351840
commit d3568d9c35
4 changed files with 41 additions and 6 deletions

View File

@@ -192,16 +192,18 @@ func (r *ReveseProxyRoute) addToLoadBalancer(parent task.Parent) {
_ = lb.Start(parent) // always return nil
linked = &ReveseProxyRoute{
Route: &Route{
Alias: cfg.Link,
Alias: cfg.Link + "-loadbalancer",
Homepage: r.Homepage,
},
HealthMon: lb,
loadBalancer: lb,
handler: lb,
}
routes.HTTP.Add(linked)
r.task.OnFinished("entrypoint_remove_route", func() {
routes.HTTP.Del(linked)
routes.HTTP.AddKey(cfg.Link, linked)
routes.All.AddKey(cfg.Link, linked)
r.task.OnFinished("remove_loadbalancer_route", func() {
routes.HTTP.DelKey(cfg.Link)
routes.All.DelKey(cfg.Link)
})
}
r.loadBalancer = lb