Merge pull request #509 from adoolaard/dev-tags

Add Tagging Feature for Reverse Proxy Hosts + Search & Filter
This commit is contained in:
Toby Chui
2025-02-06 20:35:32 +08:00
committed by GitHub
8 changed files with 214 additions and 9 deletions

View File

@@ -305,6 +305,15 @@ func ReverseProxyHandleAddEndpoint(w http.ResponseWriter, r *http.Request) {
}
}
tagStr, _ := utils.PostPara(r, "tags")
tags := []string{}
if tagStr != "" {
tags = strings.Split(tagStr, ",")
for i := range tags {
tags[i] = strings.TrimSpace(tags[i])
}
}
var proxyEndpointCreated *dynamicproxy.ProxyEndpoint
if eptype == "host" {
rootOrMatchingDomain, err := utils.PostPara(r, "rootname")
@@ -375,6 +384,8 @@ func ReverseProxyHandleAddEndpoint(w http.ResponseWriter, r *http.Request) {
// Rate Limit
RequireRateLimit: requireRateLimit,
RateLimit: int64(proxyRateLimit),
Tags: tags,
}
preparedEndpoint, err := dynamicProxyRouter.PrepareProxyRoute(&thisProxyEndpoint)
@@ -533,6 +544,15 @@ func ReverseProxyHandleEditEndpoint(w http.ResponseWriter, r *http.Request) {
return
}
tagStr, _ := utils.PostPara(r, "tags")
tags := []string{}
if tagStr != "" {
tags = strings.Split(tagStr, ",")
for i := range tags {
tags[i] = strings.TrimSpace(tags[i])
}
}
//Generate a new proxyEndpoint from the new config
newProxyEndpoint := dynamicproxy.CopyEndpoint(targetProxyEntry)
newProxyEndpoint.BypassGlobalTLS = bypassGlobalTLS
@@ -557,6 +577,7 @@ func ReverseProxyHandleEditEndpoint(w http.ResponseWriter, r *http.Request) {
newProxyEndpoint.RateLimit = proxyRateLimit
newProxyEndpoint.UseStickySession = useStickySession
newProxyEndpoint.DisableUptimeMonitor = disbleUtm
newProxyEndpoint.Tags = tags
//Prepare to replace the current routing rule
readyRoutingRule, err := dynamicProxyRouter.PrepareProxyRoute(newProxyEndpoint)