@@ -108,12 +108,18 @@ def dispatch_to_moto(context: RequestContext) -> Response:
108
108
service = context .service
109
109
request = context .request
110
110
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 ]
112
117
# 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 )
114
119
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
+ )
117
123
response = dispatch (request , raw_url , request .headers )
118
124
if not response :
119
125
# some operations are only partially implemented by moto
0 commit comments