change request log format, close to nginx ones
This commit is contained in:
parent
bc4a1ee7de
commit
954dd7540a
4 changed files with 17 additions and 4 deletions
|
@ -24,13 +24,17 @@ const resolutiontpl = `<!DOCTYPE html>
|
|||
`
|
||||
|
||||
func (s ResolutionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if addr := r.Header.Get("X-Forwarded-For"); addr != "" {
|
||||
r.RemoteAddr = addr
|
||||
}
|
||||
|
||||
if !enableResolutionRoute {
|
||||
log.Printf("UNHANDELED %s request from %s: /resolution%s [%s]\n", r.Method, r.RemoteAddr, r.URL.Path, r.UserAgent())
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("Handling %s request from %s: /resolution%s [%s]\n", r.Method, r.RemoteAddr, r.URL.Path, r.UserAgent())
|
||||
log.Printf("%s \"%s /resolution%s\" [%s]\n", r.RemoteAddr, r.Method, r.URL.Path, r.UserAgent())
|
||||
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
|
||||
|
|
Reference in a new issue