]> git.apps.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)
committerAbhishek Varshney <abhishek.varshney@flipkart.com>
Thu, 3 Nov 2016 09:02:04 +0000 (14:32 +0530)
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>
(cherry picked from commit 7c7ad3cc6e96b490743aca06428a123fe2c4cb64)

src/rgw/rgw_rest.cc

index 9065136e37d455a22e0f936e678dc0f626efc0d2..9344dd23f8dc6c39e9903b414dcd2115cab77aac 100644 (file)
@@ -1767,10 +1767,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;
     }