diff options
author | siddharth ravikumar <s@ricketyspace.net> | 2022-06-02 22:44:18 -0400 |
---|---|---|
committer | siddharth ravikumar <s@ricketyspace.net> | 2022-06-02 22:44:18 -0400 |
commit | 10137c76871d1c74baa6855a98668507105a2033 (patch) | |
tree | 0c49246037224bd1878322d991f4f5581b848c4e /main.go | |
parent | 0deec1ba35a67ec25f048acfe13b899ea2e79db6 (diff) |
main.go: update logRequest
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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")) } |