mirror of
https://github.com/minio/minio.git
synced 2025-11-09 05:34:56 -05:00
Handle incoming proxy requests ip, scheme (#5591)
This PR implements functions to get the right ip, scheme from the incoming proxied requests.
This commit is contained in:
committed by
kannappanr
parent
d71b1d25f8
commit
e4f6877c8b
@@ -28,6 +28,7 @@ import (
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/minio/minio/pkg/auth"
|
||||
"github.com/minio/minio/pkg/handlers"
|
||||
"github.com/minio/minio/pkg/madmin"
|
||||
)
|
||||
|
||||
@@ -472,17 +473,6 @@ func (a adminAPIHandlers) HealHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// Helper function to fetch client address - we use the
|
||||
// X-forwarded-for header if one is present.
|
||||
getClientAddress := func() string {
|
||||
addr := r.RemoteAddr
|
||||
fwdFor := r.Header.Get("X-Forwarded-For")
|
||||
if fwdFor == "" {
|
||||
return addr
|
||||
}
|
||||
return fwdFor
|
||||
}
|
||||
|
||||
type healResp struct {
|
||||
respBytes []byte
|
||||
errCode APIErrorCode
|
||||
@@ -530,7 +520,7 @@ func (a adminAPIHandlers) HealHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if clientToken == "" {
|
||||
// Not a status request
|
||||
nh := newHealSequence(bucket, objPrefix, getClientAddress(),
|
||||
nh := newHealSequence(bucket, objPrefix, handlers.GetSourceIP(r),
|
||||
numDisks, hs, forceStart)
|
||||
|
||||
respCh := make(chan healResp)
|
||||
|
||||
Reference in New Issue
Block a user