8000 add comment · localstack/localstack@21ed1a8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 21ed1a8

Browse files
committed
add comment
1 parent cb4d582 commit 21ed1a8

File tree

1 file changed

+10
-4
lines changed
  • localstack-core/localstack/services

1 file changed

+10
-4
lines changed

localstack-core/localstack/services/moto.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,18 @@ def dispatch_to_moto(context: RequestContext) -> Response:
108108
service = context.service
109109
request = context.request
110110

111-
raw_path = get_full_raw_path(request)
111+
# Werkzeug might have an issue (to be determined where the responsibility lies) with proxied requests where the
112+
# HTTP location is a full URI and not only a path.
113+
# We need to use the full_raw_url as moto does some path decoding (in S3 for example)
114+
full_raw_path = get_full_raw_path(request)
115+
# remove the query string from the full path to do the matching of the request
116+
raw_path_only = full_raw_path.split("?")[0]
112117
# this is where we skip the HTTP roundtrip between the moto server and the boto client
113-
dispatch = get_dispatcher(service.service_name, raw_path.split("?")[0])
118+
dispatch = get_dispatcher(service.service_name, raw_path_only)
114119
try:
115-
# we use the full_raw_url as moto might do some path decoding (in S3 for example)
116-
raw_url = get_raw_current_url(request.scheme, request.host, request.root_path, raw_path)
120+
raw_url = get_raw_current_url(
121+
request.scheme, request.host, request.root_path, full_raw_path
122+
)
117123
response = dispatch(request, raw_url, request.headers)
118124
if not response:
119125
# some operations are only partially implemented by moto

0 commit comments

Comments
 (0)
0