mirror of
https://github.com/minio/minio.git
synced 2025-11-20 18:06:10 -05:00
Handle HEAD/GET requests for virtual DNS requests (#7839)
r.URL.Path is empty when HEAD bucket with virtual DNS requests come in since bucket is now part of r.Host, we should use our domain names and fetch the right bucket/object names. This fixes an really old issue in our federation setups.
This commit is contained in:
committed by
kannappanr
parent
be72609d1f
commit
c1d2b3d5c3
12
cmd/utils.go
12
cmd/utils.go
@@ -71,8 +71,20 @@ func cloneHeader(h http.Header) http.Header {
|
||||
return h2
|
||||
}
|
||||
|
||||
func request2BucketObjectName(r *http.Request) (bucketName, objectName string) {
|
||||
path, err := getResource(r.URL.Path, r.Host, globalDomainNames)
|
||||
if err != nil {
|
||||
logger.CriticalIf(context.Background(), err)
|
||||
}
|
||||
return urlPath2BucketObjectName(path)
|
||||
}
|
||||
|
||||
// Convert url path into bucket and object name.
|
||||
func urlPath2BucketObjectName(path string) (bucketName, objectName string) {
|
||||
if path == "" || path == slashSeparator {
|
||||
return "", ""
|
||||
}
|
||||
|
||||
// Trim any preceding slash separator.
|
||||
urlPath := strings.TrimPrefix(path, slashSeparator)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user