Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Throttling upload and download speed optionally either in Django or in nginx

I need to throttle upload/download speed based on whether a user is logged in or not for my application. I'm using nginx and Django. Is there a way for me to do this?

like image 436
Naftuli Kay Avatar asked Sep 07 '25 09:09

Naftuli Kay


1 Answers

This is the job of a load balancer instead of django or nginx.

You can setup two zones with nginx and limit the bandwidth on one and not on the other. You can direct logged in users to the unlimited zone on nginx and anon users to the limited zone.

This module lets you limit on a per-ip basis: https://github.com/trbs/Nginx-limit-traffic-rate-module

like image 70
Randall Hunt Avatar answered Sep 10 '25 02:09

Randall Hunt