Skip to content

Commit

Permalink
rgw: only enable virtual hosting if hostnames are configured
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
cbodley committed Oct 3, 2016
1 parent 70e0289 commit 7c7ad3c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/rgw/rgw_rest.cc
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7c7ad3c

Please sign in to comment.