mirror of
https://github.com/skidoodle/ipinfo.git
synced 2026-04-28 01:27:34 +02:00
chore: Update IP address retrieval logic in main.go
This commit is contained in:
@@ -188,7 +188,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if IPAddress == "" || IPAddress == "self" {
|
if IPAddress == "" || IPAddress == "self" {
|
||||||
if realIP, ok := r.Header["X-Real-Ip"]; ok && len(realIP) > 0 {
|
if realIP, ok := r.Header["X-Forwarded-For"]; ok && len(realIP) > 0 {
|
||||||
IPAddress = realIP[0]
|
IPAddress = realIP[0]
|
||||||
} else {
|
} else {
|
||||||
IPAddress = extractIP(r.RemoteAddr)
|
IPAddress = extractIP(r.RemoteAddr)
|
||||||
|
|||||||
Reference in New Issue
Block a user