Use GetSourceIP for source ip as request params (#6109)

Fixes #6108
This commit is contained in:
Harshavardhana
2018-07-02 14:40:18 -07:00
committed by kannappanr
parent d7ced9a8b5
commit 6c85706c24
5 changed files with 22 additions and 12 deletions

View File

@@ -34,6 +34,7 @@ import (
"time"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/handlers"
humanize "github.com/dustin/go-humanize"
"github.com/gorilla/mux"
@@ -335,7 +336,13 @@ func newContext(r *http.Request, api string) context.Context {
if prefix != "" {
object = prefix
}
reqInfo := &logger.ReqInfo{RemoteHost: r.RemoteAddr, UserAgent: r.Header.Get("user-agent"), API: api, BucketName: bucket, ObjectName: object}
reqInfo := &logger.ReqInfo{
RemoteHost: handlers.GetSourceIP(r),
UserAgent: r.Header.Get("user-agent"),
API: api,
BucketName: bucket,
ObjectName: object,
}
return logger.SetReqInfo(context.Background(), reqInfo)
}