From: Casey Bodley Date: Fri, 30 Sep 2016 18:04:32 +0000 (-0400) Subject: rgw: only enable virtual hosting if hostnames are configured X-Git-Tag: v11.1.0~463^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7c7ad3cc6e96b490743aca06428a123fe2c4cb64;p=ceph.git rgw: only enable virtual hosting if hostnames are configured if no hostnames are configured, all requests were treated as virtual hosted buckets. require at least one hostname in hostnames_set to consider setting in_hosted_domain Fixes: http://tracker.ceph.com/issues/17440 Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index cb0d768002a..76336456a75 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -1846,10 +1846,12 @@ int RGWREST::preprocess(struct req_state *s, RGWClientIO* cio) // As additional checks: // - if the Host header is an IP, we're using path-style access without DNS // - Also check that the Host header is a valid bucket name before using it. + // - Don't enable virtual hosting if no hostnames are configured if (subdomain.empty() && (domain.empty() || domain != info.host) && !looks_like_ip_address(info.host.c_str()) - && RGWHandler_REST::validate_bucket_name(info.host) == 0) { + && RGWHandler_REST::validate_bucket_name(info.host) == 0 + && !(hostnames_set.empty() && hostnames_s3website_set.empty())) { subdomain.append(info.host); in_hosted_domain = 1; }