1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-11-27 08:27:06 +02:00

removed RequestEvent.UnsafeRealIP

This commit is contained in:
Gani Georgiev
2024-11-05 21:49:45 +02:00
parent 9506669095
commit f38700982c
5 changed files with 4024 additions and 4129 deletions

View File

@@ -397,17 +397,9 @@ func logRequest(event *core.RequestEvent, err error) {
}
if event.App.Settings().Logs.LogIP {
var userIP string
if len(event.App.Settings().TrustedProxy.Headers) > 0 {
userIP = event.RealIP()
} else {
// fallback to the legacy behavior (it is "safe" since it is only for log purposes)
userIP = cutStr(event.UnsafeRealIP(), 50)
}
attrs = append(
attrs,
slog.String("userIP", userIP),
slog.String("userIP", event.RealIP()),
slog.String("remoteIP", event.RemoteIP()),
)
}