mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-09 19:20:56 +08:00
fix: Fix the problem of abnormal request forwarding (#9548)
This commit is contained in:
parent
e66bd43fc6
commit
6b673017c5
1 changed files with 8 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ package middleware
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
||||||
"github.com/1Panel-dev/1Panel/agent/global"
|
"github.com/1Panel-dev/1Panel/agent/global"
|
||||||
|
|
@ -25,9 +26,14 @@ func Certificate() gin.HandlerFunc {
|
||||||
helper.InternalServer(c, fmt.Errorf("err certificate"))
|
helper.InternalServer(c, fmt.Errorf("err certificate"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
masterProxyID := c.Request.Header.Get("Proxy-ID")
|
conn := c.Request.Header.Get("Connection")
|
||||||
|
if conn == "Upgrade" {
|
||||||
|
c.Next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
masterProxyID := c.Request.Header.Get("Proxy-Id")
|
||||||
proxyID, err := cmd.RunDefaultWithStdoutBashC("cat /etc/1panel/.nodeProxyID")
|
proxyID, err := cmd.RunDefaultWithStdoutBashC("cat /etc/1panel/.nodeProxyID")
|
||||||
if err == nil && len(proxyID) != 0 && proxyID != masterProxyID {
|
if err == nil && len(proxyID) != 0 && strings.TrimSpace(proxyID) != strings.TrimSpace(masterProxyID) {
|
||||||
helper.InternalServer(c, fmt.Errorf("err proxy id"))
|
helper.InternalServer(c, fmt.Errorf("err proxy id"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue