How do I configure nginx to return 429 http code when rate limiting?

Daniel Urstöger
31-07-2013 18:03

Well this is actually what you want, because usually nginx would just send out error 503 and that is simply a server error when instead you are trying to tell the client that the access rate is too high. So we tell nginx to use return code 429 instead of 503:

Put this into nginx.conf in http {}

limit_req_status 429;
limit_conn_status 429;
Average rating: 0 (0 Votes)

You cannot comment on this entry