You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* For redirect rule with HTTP protocol, port will be anyhow 80
46
+
* For redirect rule with HTTPS protocol, port will be anyhow 443
47
+
* So, we can check if there is any ingress rule with same domain and port
48
+
*/
49
+
ifredirectRule.Protocol==HTTPProtocol {
50
+
isIngressRuleExist=db.Where("domain_id = ? AND protocol = ? AND port = ?", redirectRule.DomainID, redirectRule.Protocol, 80).First(&IngressRule{}).RowsAffected>0
51
+
} elseifredirectRule.Protocol==HTTPSProtocol {
52
+
isIngressRuleExist=db.Where("domain_id = ? AND protocol = ? AND port = ?", redirectRule.DomainID, redirectRule.Protocol, 443).First(&IngressRule{}).RowsAffected>0
53
+
}
41
54
ifisIngressRuleExist {
42
55
returnerrors.New("there is ingress rule with same domain and port")
43
56
}
44
-
// verify if there is no redirect rule with same domain and port
45
-
isRedirectRuleExist:=db.Where("domain_id = ? AND port = ?", redirectRule.DomainID, redirectRule.Port).First(&RedirectRule{}).RowsAffected>0
57
+
// verify if there is no redirect rule with same domain and protocl
58
+
isRedirectRuleExist:=db.Where("domain_id = ? AND protocol = ?", redirectRule.DomainID, redirectRule.Protocol).First(&RedirectRule{}).RowsAffected>0
46
59
ifisRedirectRuleExist {
47
60
returnerrors.New("there is redirect rule with same domain and port")
0 commit comments