'How can I leverage nginx to enforce a delay/rate-limit between outbound requests?

I am working with an external API that expects me to self-limit requests to no more than one request every 20 milliseconds (500 req/s total). I can easily do this for a single instance of my server; however, I am running multiple instances behind an nginx controller and need the throttling to happen only for calls to this specific external API.

Can nginx help me accomplish this? If so, how?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source