summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorsiddharth ravikumar <s@ricketyspace.net>2022-06-02 22:44:18 -0400
committersiddharth ravikumar <s@ricketyspace.net>2022-06-02 22:44:18 -0400
commit10137c76871d1c74baa6855a98668507105a2033 (patch)
tree0c49246037224bd1878322d991f4f5581b848c4e /main.go
parent0deec1ba35a67ec25f048acfe13b899ea2e79db6 (diff)
main.go: update logRequest
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"))
}