mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-20 20:07:52 +02:00
If X-Real-IP header isn't set, use the client's real IP instead of unknwon (fixes #126)
This commit is contained in:
parent
d8b83b9429
commit
67c67b76cd
@ -69,7 +69,7 @@ func getHishtoryVersion(r *http.Request) string {
|
|||||||
func getRemoteAddr(r *http.Request) string {
|
func getRemoteAddr(r *http.Request) string {
|
||||||
addr, ok := r.Header["X-Real-Ip"]
|
addr, ok := r.Header["X-Real-Ip"]
|
||||||
if !ok || len(addr) == 0 {
|
if !ok || len(addr) == 0 {
|
||||||
return "UnknownIp"
|
return r.RemoteAddr
|
||||||
}
|
}
|
||||||
return addr[0]
|
return addr[0]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user