Commit 2aa958e0 authored by Nimi Wariboko Jr's avatar Nimi Wariboko Jr

Update {remote} replacer to use X-Forwarded-For if its provided

parent 4a4b8045
......@@ -33,6 +33,9 @@ func NewReplacer(r *http.Request, rr *responseRecorder) replacer {
"{fragment}": r.URL.Fragment,
"{proto}": r.Proto,
"{remote}": func() string {
if fwdFor := r.Header.Get("X-Forwarded-For"); fwdFor != "" {
return fwdFor
}
host, _, err := net.SplitHostPort(r.RemoteAddr)
if err != nil {
return r.RemoteAddr
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment