How does one configure nginx for a heroku nodejs web application? I would like to configure nginx such that an IP address is limited to N requests for a given time period. Like the classic "You're doing that too much" message as seen on Reddit.
Thanks,
Charles
Installing Nginx on HerokuYou can run multiple processes and applications in your Dyno by using the Heroku Multi Buildpack in combination with the Heroku Runit Buildpack. This allows you to specify any amount of buildpacks to run on one Dyno.
For Nginx to route to the Node. js application listening on port 3000, we'll need to first unlink the default configuration of Nginx and then create a new configuration to be used for by our Node. js application. The Nginx configuration is kept in the /etc/nginx/sites-available directory.
Select NodeJS from the options and click Save changes. Now, go back to the Deploy tab, and click Deploy Branch at the bottom. Heroku will take the code and host it.
Good starting point : heroku/heroku-buildpack-nginx
What you are looking for is rate-limiting with NGINX, read this for a better understanding
and here you have an example gist: NGINX reverse proxy with rate limiting
This is the file of the heroku-nginx-node-example that I think you have to add the limit_req options
If you need more help, show what you have tried so far and I will edit this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With