fix get_raw_path parsing
diff --git a/localstack/http/request.py b/localstack/http/request.py
index 5aa8a98f81232..46169759d615f 100644
--- a/localstack/http/request.py
+++ b/localstack/http/request.py
@@ -1,6 +1,6 @@
 from io import BytesIO
 from typing import IO, TYPE_CHECKING, Dict, Mapping, Optional, Tuple, Union
-from urllib.parse import quote, unquote, urlencode
+from urllib.parse import quote, unquote, urlencode, urlparse
 
 if TYPE_CHECKING:
     from _typeshed.wsgi import WSGIEnvironment
@@ -187,15 +187,16 @@ def application(cls, *args):
 def get_raw_path(request) -> str:
     """
     Returns the raw_path inside the request without the query string. The request can either be a Quart Request
-    object (that encodes the raw path in request.scope['raw_path']) or a Werkzeug WSGi request (that encodes the raw
-    path in request.environ['RAW_URI']).
+    object (that encodes the raw path in request.scope['raw_path']) or a Werkzeug WSGI request (that encodes the raw
+    URI in request.environ['RAW_URI']).
 
     :param request: the request object
     :return: the raw path if any
     """
     if hasattr(request, "environ"):
         # werkzeug/flask request (already a string, and contains the query part)
-        return request.environ.get("RAW_URI", request.path).split("?")[0]
+        # we need to parse it, because the RAW_URI can contain a full URL if it is specified in the HTTP request
+        return urlparse(request.environ.get("RAW_URI", request.path)).path
 
     if hasattr(request, "scope"):
         # quart request raw_path comes as bytes, and without the query part
diff --git a/tests/unit/http_/test_request.py b/tests/unit/http_/test_request.py
index 21fa3b365d110..062aee09096cf 100644
--- a/tests/unit/http_/test_request.py
+++ b/tests/unit/http_/test_request.py
@@ -137,6 +137,16 @@ def test_get_raw_path_with_query():
     assert get_raw_path(request) == "/foo%2Fbar/ed"
 
 
+def test_get_raw_path_with_full_uri():
+    # raw_path is actually raw_uri in the WSGI environment
+    # it can be a full URL
+    request = Request("GET", "/foo/bar/ed", raw_path="http://localhost:4566/foo%2Fbar/ed")
+
+    assert request.path == "/foo/bar/ed"
+    assert request.environ["RAW_URI"] == "http://localhost:4566/foo%2Fbar/ed"
+    assert get_raw_path(request) == "/foo%2Fbar/ed"
+
+
 def test_headers_retain_dashes():
     request = Request("GET", "/foo/bar/ed", {"X-Amz-Meta--foo_bar-ed": "foobar"})
     assert "x-amz-meta--foo_bar-ed" in request.headers

<!-- Please refer to the contribution guidelines before raising a PR: https://github.com/localstack/localstack/blob/master/CONTRIBUTING.md -->

<!-- Why am I raising this PR? Add context such as related issues, PRs, or documentation. -->
## Motivation
This PR would fix #8928 and #8924. We had an issue with parsing the WSGI environ `RAW_URI`, because an HTTP request can also contain a full URL and not only an absolute path. See the RFC: https://www.ietf.org/rfc/rfc2616.txt
```
   To allow for transition to absoluteURIs in all requests in future
   versions of HTTP, all HTTP/1.1 servers MUST accept the absoluteURI
   form in requests, even though HTTP/1.1 clients will only generate
   them in requests to proxies.
```

We would then have more than the path with `get_raw_path`, which lead to issue down the road when trying to match in our router.

<!-- What notable changes does this PR make? -->
## Changes
We now thanks to @dfangl parse the `RAW_URI` variable with `urllib.parse.urlparse` to then only get the `path` part of the `RAW_URI` in case there's more. 
Added a unit test covering this use case.

<!-- The following sections are optional, but can be useful! 

## Testing

Description of how to test the changes

## TODO

What's left to do:

- [ ] ...
- [ ] ...

-->

