use S3 path style addressing when running in kubernetes (#1315)

This commit is contained in:
Waldemar Hummer 2017-11-15 14:37:39 -05:00 committed by Terry Cain
parent aa6a0765c1
commit cdb7305dac

View File

@ -55,8 +55,10 @@ class ResponseObject(_TemplateEnvironmentMixin):
if not host:
host = urlparse(request.url).netloc
if not host or host.startswith("localhost") or re.match(r"^[^.]+$", host):
# For localhost or local domain names, default to path-based buckets
if (not host or host.startswith('localhost') or
re.match(r'^[^.]+$', host) or re.match(r'^.*\.svc\.cluster\.local$', host)):
# Default to path-based buckets for (1) localhost, (2) local host names that do not
# contain a "." (e.g., Docker container host names), or (3) kubernetes host names
return False
match = re.match(r'^([^\[\]:]+)(:\d+)?$', host)