From e3eb4d1809149447c87a27fb47828a1ea95fc7d2 Mon Sep 17 00:00:00 2001 From: Steve Pulec Date: Sun, 21 Jul 2019 21:31:19 -0500 Subject: [PATCH] Cleanup host parsing. --- moto/server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/moto/server.py b/moto/server.py index 971589cac..7e251e2f5 100644 --- a/moto/server.py +++ b/moto/server.py @@ -95,13 +95,14 @@ class DomainDispatcherApplication(object): if six.PY3 and isinstance(path_info, six.binary_type): path_info = path_info.decode('utf-8') + host = None if path_info.startswith("/moto-api") or path_info == "/favicon.ico": host = "moto_api" elif path_info.startswith("/latest/meta-data/"): host = "instance_metadata" else: host = environ['HTTP_HOST'].split(':')[0] - if host in {'localhost', 'motoserver'} or host.startswith("192.168."): + if host is None: service, region = self.infer_service_region(environ) if service == 'dynamodb': if environ['HTTP_X_AMZ_TARGET'].startswith('DynamoDBStreams'):