mirror of
https://github.com/skidoodle/ipinfo.git
synced 2025-02-15 08:29:17 +01:00
chore: Update IP address retrieval logic in main.go
This commit is contained in:
2
main.go
2
main.go
@@ -188,7 +188,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
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]
|
||||
} else {
|
||||
IPAddress = extractIP(r.RemoteAddr)
|
||||
|
Reference in New Issue
Block a user