Limit bandwidth on HTTP downloads based on file size

2

Is there a way to limit lets say in iptables or any proxy solution/software if a user is downloading a filesize that is greater than lets say 20MB it will limit his entire download at 2KB/s?

Basically i want to put a server between me and my modem and if the user is downloading a file based on extensions or http download it will limit him to 2KB the entire download.

Is this possible? I know that somehow the packets need to be read but im lost at how to implement this.

Basically if a user downloads a file via http thats over 20MB it will limit his speed to 2KB is all im trying to implement.

sonicboom

Posted 2013-09-12T16:21:27.617

Reputation: 161

Regardless of how you do it this won't be fool proof, as HTTP downloads require the site to provide a Content-Length for the browser to know the expected size. If they didn't, then the browser will just download it until it's done, without knowing the length/size in advance. – Ƭᴇcʜιᴇ007 – 2013-09-12T16:38:14.193

I see, is there any solution or package available to do something like this? Or achieve something close? – sonicboom – 2013-09-12T16:41:31.310

There's lots of options/solutions for Quality of Service (QoS - check your router for instance) for controlling bandwidth for certain services/protocols and even users in some cases. But doing it be file size isn't usual at all - partially because of what I mentioned I'm sure. Having said that, while I don't know of anything that will do it, someone else might. :)

– Ƭᴇcʜιᴇ007 – 2013-09-12T16:45:07.767

So it is probably a custom solution i would be needing then? Yeah i see what you mean – sonicboom – 2013-09-12T16:45:43.190

I think the Tomato router firmware's QoS has an option to classify a connection under bulk priority after a certain amount of data is transmitted, but I'm not sure how common such a feature is in general. – jjlin – 2013-09-12T22:29:57.303

No answers