I have a backend service running on port 8080. There are two endpoints:
- GET /item
- POST /item
I configured Nginx in the following way:
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=20r/m;
server{
listen 81;
root /var/www;
location /api {
location /api/item {
limit_req zone=mylimit;
proxy_pass http://127.0.0.1:8080/item;
}
}
}
This configuration rate limits requests for both the GET and POST method.
How to rate limit only the POST method?