mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 13:29:05 +01:00
fix: Remove port before IP check
This commit is contained in:
parent
a407a5cf01
commit
7a5ccff6da
@ -210,6 +210,10 @@ func securedCheck(r *http.Request) error {
|
|||||||
IPAddress = r.RemoteAddr
|
IPAddress = r.RemoteAddr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.Contains(IPAddress, ":") {
|
||||||
|
IPAddress = strings.Split(IPAddress, ":")[0]
|
||||||
|
}
|
||||||
|
|
||||||
// check if IP is allowed
|
// check if IP is allowed
|
||||||
if !util.Contains(config.Keys.ApiAllowedIPs, IPAddress) {
|
if !util.Contains(config.Keys.ApiAllowedIPs, IPAddress) {
|
||||||
return fmt.Errorf("unknown ip: %v", IPAddress)
|
return fmt.Errorf("unknown ip: %v", IPAddress)
|
||||||
|
Loading…
Reference in New Issue
Block a user