mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-09-22 08:00:53 +00:00
fix: Fixed issue with sync ssl to node failed (#10393)
Refs https://github.com/1Panel-dev/1Panel/issues/10237
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user