From c4086190428c8ca05dbc5b81aef50187a611fa87 Mon Sep 17 00:00:00 2001 From: CityFun <31820853+zhengkunwang223@users.noreply.github.com> Date: Wed, 17 Sep 2025 15:11:59 +0800 Subject: [PATCH] fix: Fixed issue with sync ssl to node failed (#10393) Refs https://github.com/1Panel-dev/1Panel/issues/10237 --- core/middleware/bind_domain.go | 5 +++++ core/middleware/ip_limit.go | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/middleware/bind_domain.go b/core/middleware/bind_domain.go index 1a1288e4d..ad85708f9 100644 --- a/core/middleware/bind_domain.go +++ b/core/middleware/bind_domain.go @@ -10,6 +10,11 @@ import ( func BindDomain() gin.HandlerFunc { return func(c *gin.Context) { + localRequest := c.GetBool("LOCAL_REQUEST") + if localRequest { + c.Next() + return + } settingRepo := repo.NewISettingRepo() status, err := settingRepo.Get(repo.WithByKey("BindDomain")) if err != nil { diff --git a/core/middleware/ip_limit.go b/core/middleware/ip_limit.go index 7e618481a..c2f5b53ac 100644 --- a/core/middleware/ip_limit.go +++ b/core/middleware/ip_limit.go @@ -11,6 +11,14 @@ import ( func WhiteAllow() gin.HandlerFunc { return func(c *gin.Context) { + tokenString := c.GetHeader("X-Panel-Local-Token") + clientIP := c.ClientIP() + if clientIP == "127.0.0.1" && tokenString != "" && c.Request.URL.Path == "/api/v2/core/xpack/sync/ssl" { + c.Set("LOCAL_REQUEST", true) + c.Next() + return + } + settingRepo := repo.NewISettingRepo() status, err := settingRepo.Get(repo.WithByKey("AllowIPs")) if err != nil { @@ -22,7 +30,6 @@ func WhiteAllow() gin.HandlerFunc { c.Next() return } - clientIP := c.ClientIP() for _, ip := range strings.Split(status.Value, ",") { if len(ip) == 0 { continue