mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-18 07:24:31 +01:00
v0.5: (BREAKING) replacing path with path_patterns, improved docker monitoring mechanism, bug fixes
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
U "github.com/yusing/go-proxy/api/v1/utils"
|
||||
"github.com/yusing/go-proxy/config"
|
||||
PT "github.com/yusing/go-proxy/proxy/fields"
|
||||
R "github.com/yusing/go-proxy/route"
|
||||
)
|
||||
|
||||
@@ -24,17 +23,7 @@ func CheckHealth(cfg *config.Config, w http.ResponseWriter, r *http.Request) {
|
||||
U.HandleErr(w, r, U.ErrNotFound("target", target), http.StatusNotFound)
|
||||
return
|
||||
case *R.HTTPRoute:
|
||||
path, err := PT.NewPath(r.FormValue("path"))
|
||||
if err.IsNotNil() {
|
||||
U.HandleErr(w, r, err, http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
sr, hasSr := route.GetSubroute(path)
|
||||
if !hasSr {
|
||||
U.HandleErr(w, r, U.ErrNotFound("path", string(path)), http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
ok = U.IsSiteHealthy(sr.TargetURL.String())
|
||||
ok = U.IsSiteHealthy(route.TargetURL.String())
|
||||
case *R.StreamRoute:
|
||||
ok = U.IsStreamHealthy(
|
||||
string(route.Scheme.ProxyScheme),
|
||||
|
||||
Reference in New Issue
Block a user