I have a server in nginx configured and have the following code to create my rate limit zone:
limit_req_zone $key zone=six_zone:10m rate=60r/m;
In my location, I use a module to serve the requests. This location supports GET, POST and DELETE methods. I am trying to rate limit only GET requests to that location. This is what I thought might work but it does not.
location /api/ {
if ($request_method = GET) {
limit_req zone=six_zone;
}
reqfwder;
}
Any help or pointers towards how I can approach this? Thanks.