I am trying to implement rate limiting for GET and POST for the same API call. The only difference in both the request is extra ID we are passing with POST.
GET /rest/v1/add
POST /rest/vi/add/some-alpha-numeric-id-001
Since these are two separate request so I am trying to implement rate limiting for both.
#To match GET Request
match {
expr {
expression = <<EOT
request.path.matches(R"/v1/add$")
EOT
}
}
#To match POST request
match {
expr {
expression = <<EOT
request.path.matches(R"/vi/add/.*")
EOT
}
}
Do you have any suggestions to implement the rate limiting for both GET and POST request?
If I am using only request.path.matches("/v1/add")
then it will obviously apply on both the but I am trying to setup different threshold for both request.
PS: I got to know about RAW pattern matching from here.