From 01f3b60c09109f6805ed01e6e4eb27c693a6c30a Mon Sep 17 00:00:00 2001 From: Daniel Wallace Date: Mon, 17 Feb 2020 17:38:53 -0600 Subject: [PATCH] Allow ports in k8s service urls for s3 mock If there is a port in the host for the request, then this if statement is not tripped. --- moto/s3/responses.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moto/s3/responses.py b/moto/s3/responses.py index 6041201bf..0e68a3116 100644 --- a/moto/s3/responses.py +++ b/moto/s3/responses.py @@ -168,7 +168,7 @@ class ResponseObject(_TemplateEnvironmentMixin, ActionAuthenticatorMixin): or host.startswith("localhost") or host.startswith("localstack") or re.match(r"^[^.]+$", host) - or re.match(r"^.*\.svc\.cluster\.local$", host) + or re.match(r"^.*\.svc\.cluster\.local:?\d*$", host) ): # Default to path-based buckets for (1) localhost, (2) localstack hosts (e.g. localstack.dev), # (3) local host names that do not contain a "." (e.g., Docker container host names), or