summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.go b/main.go
index 8aee763..b31bb2e 100644
--- a/main.go
+++ b/main.go
@@ -265,5 +265,9 @@ func NewSearch(r *http.Request) (*Search, error) {
}
func logRequest(r *http.Request) {
- log.Printf("%v - %v", r.RemoteAddr, r.URL)
+ addr := r.RemoteAddr
+ if len(r.Header.Get("X-Forwarded-For")) > 0 {
+ addr = r.Header.Get("X-Forwarded-For")
+ }
+ log.Printf("%v - %v - %v", addr, r.URL, r.Header.Get("User-agent"))
}