2

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?

Anton Klichkov
  • 133
  • 1
  • 3
  • 11
  • Does this answer your question? [Nginx Rate limit GET or POST requests only at a location](https://stackoverflow.com/questions/60307759/nginx-rate-limit-get-or-post-requests-only-at-a-location) – return1.at Jun 15 '22 at 09:49

0 Answers0