Hello Viet, I posted the same question on Digital Ocean forums and got a response suggesting to intercept errors from upstream and to rate limit based on the error using the `error_page` directive. I haven't tried it myself yet but it's worth a shot. Here's a link to the full post: https://www.digitalocean.com/community/questions/use-nginx-to-rate-limit-only-when-origin-server-response-code-is-401. Let me know if this works for you.
Regards, Krishna Veera Reddy Posted at Nginx Forum: https://forum.nginx.org/read.php?2,279547,279595#msg-279595 _______________________________________________ nginx mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx
