mirror of
https://github.com/minio/minio.git
synced 2025-11-21 02:09:08 -05:00
Fix host address returned in admin API calls (#7846)
This commit is contained in:
@@ -31,6 +31,7 @@ import (
|
||||
"github.com/minio/minio/cmd/logger"
|
||||
"github.com/minio/minio/pkg/auth"
|
||||
"github.com/minio/minio/pkg/handlers"
|
||||
xnet "github.com/minio/minio/pkg/net"
|
||||
)
|
||||
|
||||
// Parses location constraint from the incoming reader.
|
||||
@@ -384,3 +385,17 @@ func notFoundHandlerJSON(w http.ResponseWriter, r *http.Request) {
|
||||
func notFoundHandler(w http.ResponseWriter, r *http.Request) {
|
||||
writeErrorResponse(context.Background(), w, errorCodes.ToAPIErr(ErrMethodNotAllowed), r.URL, guessIsBrowserReq(r))
|
||||
}
|
||||
|
||||
// gets host name for current node
|
||||
func getHostName(r *http.Request) (hostName string, err error) {
|
||||
var thisAddr *xnet.Host
|
||||
hostName = r.Host
|
||||
if globalIsDistXL {
|
||||
thisAddr, err = xnet.ParseHost(GetLocalPeer(globalEndpoints))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
hostName = thisAddr.String()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user