]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: only enable virtual hosting if hostnames are configured
authorCasey Bodley <cbodley@redhat.com>
Fri, 30 Sep 2016 18:04:32 +0000 (14:04 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 3 Oct 2016 18:25:23 +0000 (14:25 -0400)
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 <cbodley@redhat.com>
src/rgw/rgw_rest.cc

index cb0d768002a4e161cae7ad1c0d32e64223a8ec3c..76336456a757914d8c5fe92cc81b43e179acc697 100644 (file)
@@ -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;
     }