mirror of
https://github.com/zitadel/zitadel.git
synced 2025-05-01 23:50:50 +00:00
fix: parsing of ip address (#2045)
This commit is contained in:
parent
6ff434e853
commit
9413fc19ff
@ -77,7 +77,8 @@ func RemoteIPStringFromRequest(r *http.Request) string {
|
||||
if ok {
|
||||
return ip
|
||||
}
|
||||
return r.RemoteAddr
|
||||
host, _, _ := net.SplitHostPort(r.RemoteAddr)
|
||||
return host
|
||||
}
|
||||
|
||||
func GetAuthorization(r *http.Request) string {
|
||||
@ -91,7 +92,7 @@ func GetOrgID(r *http.Request) string {
|
||||
func GetForwardedFor(headers http.Header) (string, bool) {
|
||||
forwarded, ok := headers[ForwardedFor]
|
||||
if ok {
|
||||
ip := strings.Split(forwarded[0], ", ")[0]
|
||||
ip := strings.TrimSpace(strings.Split(forwarded[0], ",")[0])
|
||||
if ip != "" {
|
||||
return ip, true
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user