mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-10 08:13:58 +00:00
fix: correctly get x-forwarded-for for browser info in events (#9149)
# Which Problems Are Solved Events like "password check succeeded" store some information about the caller including their IP. The `X-Forwarded-For` was not correctly logged, but instead the RemoteAddress. # How the Problems Are Solved - Correctly get the `X-Forwarded-For` in canonical form. # Additional Changes None # Additional Context closes [#9106](https://github.com/zitadel/zitadel/issues/9106)
This commit is contained in:
parent
db8d794794
commit
c966446f80
@ -108,14 +108,8 @@ func GetOrgID(r *http.Request) string {
|
||||
}
|
||||
|
||||
func GetForwardedFor(headers http.Header) (string, bool) {
|
||||
forwarded, ok := headers[ForwardedFor]
|
||||
if ok {
|
||||
ip := strings.TrimSpace(strings.Split(forwarded[0], ",")[0])
|
||||
if ip != "" {
|
||||
return ip, true
|
||||
}
|
||||
}
|
||||
return "", false
|
||||
forwarded := strings.Split(headers.Get(ForwardedFor), ",")[0]
|
||||
return forwarded, forwarded != ""
|
||||
}
|
||||
|
||||
func RemoteAddrFromCtx(ctx context.Context) string {
|
||||
|
Loading…
x
Reference in New Issue
Block a user