Local Web Server Bandwidth Limiting..As part of the (in progress) major overhaul of all the web code here at corz.org (and all the release versions of the modules that make up corz.org) I am working on my slideshow app..
It's neat, of course. One of the neatest things about it, is how it loads the next image in advance (or previous, if you are going backwards) and while doing this, posts a groovy CSS3 progress bar to let you know. When complete, the progress bar hits 100% and your next image is ready.
It a lovely idea but testing it, is anther story. My LAN is just too fast! The progress hits 100% in microseconds. Not groovy. What I need is a way to replicate the slow connexions of the internet here in the workshop. The slower the better.
There used to be an add-on for Firefox (throttle) which did this right in your browser, but it sadly does not work with recent version of Firefox.
So I was just about to break out my tc man page when I remembered that Apache has bandwidth limiting built-in. Or rather, available as a module. However, I haven't played around with the mod_bw replacement yet, whatever it is, slow connexions is generally not a thing people want. But I need it right now.
I begin by enabling a likely looking module, un-commenting the line in my httpd.conf..
LoadModule ratelimit_module lib/httpd/modules/mod_ratelimit.so
Then adding a section to my local vhost config..
<Location /imaging> SetOutputFilter RATE_LIMIT SetEnv rate-limit 50 </Location>
Restart Apache and BaddaBang! It's like I got dial-up!