fix: Remove port before IP check

This commit is contained in:
Jan Eitzinger 2023-09-07 16:36:47 +02:00
parent a407a5cf01
commit 7a5ccff6da

View File

@ -210,6 +210,10 @@ func securedCheck(r *http.Request) error {
IPAddress = r.RemoteAddr
}
if strings.Contains(IPAddress, ":") {
IPAddress = strings.Split(IPAddress, ":")[0]
}
// check if IP is allowed
if !util.Contains(config.Keys.ApiAllowedIPs, IPAddress) {
return fmt.Errorf("unknown ip: %v", IPAddress)