mirror of
https://github.com/zitadel/zitadel.git
synced 2025-05-02 14:40: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 {
|
if ok {
|
||||||
return ip
|
return ip
|
||||||
}
|
}
|
||||||
return r.RemoteAddr
|
host, _, _ := net.SplitHostPort(r.RemoteAddr)
|
||||||
|
return host
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAuthorization(r *http.Request) string {
|
func GetAuthorization(r *http.Request) string {
|
||||||
@ -91,7 +92,7 @@ func GetOrgID(r *http.Request) string {
|
|||||||
func GetForwardedFor(headers http.Header) (string, bool) {
|
func GetForwardedFor(headers http.Header) (string, bool) {
|
||||||
forwarded, ok := headers[ForwardedFor]
|
forwarded, ok := headers[ForwardedFor]
|
||||||
if ok {
|
if ok {
|
||||||
ip := strings.Split(forwarded[0], ", ")[0]
|
ip := strings.TrimSpace(strings.Split(forwarded[0], ",")[0])
|
||||||
if ip != "" {
|
if ip != "" {
|
||||||
return ip, true
|
return ip, true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user