Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

It's possible to restrict the speed using the rate limit on a specific location.

However, how can we do it dynamically ?

Let say you have paid vs non-paid users and you want to give an higher bandwidth to paid users.

We would need to dynamically check in the Database and allow a certain speed for this particular group of users.

Do you have any nginx module in mind ?

share|improve this question

1 Answer 1

Yes, you can rate limit on a specific location.

location /something/ { 
    set $limit_rate  4k; 
}

You can also surround the limite_rate with statements like if as well to dynamically control the rates. See this link for further details on limite rate: http://wiki.nginx.org/NginxHttpCoreModule#limit_rate

There is another module you should be mindful of: http://wiki.nginx.org/NginxHttpLimitZoneModule

That module allows you to set limits of connection count. So, even if you set a low limit, if they can just make 10 connections, your limit is rather meaningless.

I suggest you have private and public users get different links so that nginx can easily distinguish between the types of users and verify in your application layer for security.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.