If X-Real-IP header isn't set, use the client's real IP instead of unknwon (fixes #126)

This commit is contained in:
David Dworken 2023-11-18 12:11:12 -08:00
parent d8b83b9429
commit 67c67b76cd
No known key found for this signature in database

View File

@ -69,7 +69,7 @@ func getHishtoryVersion(r *http.Request) string {
func getRemoteAddr(r *http.Request) string {
addr, ok := r.Header["X-Real-Ip"]
if !ok || len(addr) == 0 {
return "UnknownIp"
return r.RemoteAddr
}
return addr[0]
}