浏览代码

fix(waf): 修正端口冲突检测逻辑

- 在检查 HTTP 和 HTTPS 端口冲突时,排除当前规则本身
-修复了修改规则时误报端口已被占用的问题
fusu 13 小时之前
父节点
当前提交
6b3189f74e
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      internal/service/api/waf/wafformatter.go

+ 3 - 0
internal/service/api/waf/wafformatter.go

@@ -579,6 +579,9 @@ func (s *wafFormatterService) verifyWebForwardingPort(ctx context.Context, proto
 	for _, rule := range existingRules {
 		// 关键检查:HTTP 和 HTTPS 不能在同一个端口上共存。
 		if rule.IsHttps != isNewRuleHTTPS {
+			if int64(rule.Id) == id {
+				continue
+			}
 			return errPortInUse
 		}