diff --git a/http.py b/http.py index 1487548bee980711affeda5e01af0ed4fec4e8a7..40e0a4449fa7032a918cc07fc292a5f06aab353c 100644 --- a/http.py +++ b/http.py @@ -49,6 +49,13 @@ class http(Custom): # - URI prefix: string match with the beginning of the URI uri = self.protocol_data.get("uri", None) if uri is not None: + # If URI contains HTTP request parameters, remove them + if "?" in uri: + uri = uri.split("?")[0] + uri += "*" if not uri.endswith("*") else "" + self.protocol_data["uri"] = uri + + # Add URI match rule length = len(uri) - 1 if uri.endswith("*") or uri.endswith("$") else len(uri) + 1 rule = {"forward": f"strncmp(http_message.uri, \"{{}}\", {length}) == 0"} self.add_field("uri", rule, is_backward)