0

I'm using below nginx block. I want to exclude all requests for js and CSS files from nginx rate limiting. With my below nginx directives, rate limiting is excluded to all files apart from /api route. How to fix it? I want to only exclude js & css files from rate limiting. My nginx version is nginx/1.18.0 (Ubuntu).

limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=1r/s; server { # other server directives... # Location block for JavaScript files (no rate limiting) location ~* \.(js|css)$ { # No limit_req here, so no rate limiting applies } # General location block with rate limiting for other requests location / { limit_req zone=req_limit_per_ip burst=5 nodelay; # Rate limit applied here } location /api { limit_req zone=req_limit_per_ip burst=5 nodelay; # Rate limit applied here } } 
1
  • I don't see any reason for limit_req to not working for your main location. Are there any other locations in your nginx config? Commented Apr 2 at 17:23

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.