Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

How to throttle the FCC to dial up modem speeds on your website using Apache.

View ferengi-apache.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
# How to throttle the FCC to dial up modem speeds on your website using Apache.
 
# Ported from https://gist.github.com/kyledrake/e6046644115f185f7af0
 
## The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
##
## Current known FCC address ranges:
## https://news.ycombinator.com/item?id=7716915
##
## Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
 
## For Apache 2.4.* and above
#
# 1) First, make sure you have Apache 2.4 or above. (In terminal: apache2 -v)
#
# 2) Enable the ratelimit module and reload apache2: sudo a2enmod ratelimit && sudo service apache2 reload
#
# 3) Copy and paste the text below into your site root .htaccess or your site .conf file:
 
<If "-R '192.133.125.0/24'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 28
</If>
 
<ElseIf "-R '165.135.0.0/16'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 28
</ElseIf>
 
<ElseIf "-R '192.104.54.0/24'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 28
</ElseIf>
 
<ElseIf "-R '4.21.126.0/24'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 28
</ElseIf>
 
<ElseIf "-R '65.125.25.64/26'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 28
</ElseIf>
 
<ElseIf "-R '208.23.64.0/25'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 28
</ElseIf>
 
<ElseIf "-R '2620:0:610::/48'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 56
</ElseIf>
 
<ElseIf "-R '2600:803:230::/48'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 56
</ElseIf>
 
## For Apache 2.2
#
# 1) First, you need mod_bw (On Ubuntu: sudo apt-get install libapache2-mod-bw)
#
# 2) Enable mod_bw and reload apache2: sudo a2enmod bw && sudo service apache2 reload
#
# 3) Copy and paste the text below into your site .conf file in between the <VirtualHost> tags (You can't do this in .htaccess as it's unsupported by the module)
 
BandWidthModule On
ForceBandWidthModule On
BandWidth 192.133.125.0/24 28
BandWidth 165.135.0.0/16 28
BandWidth 192.104.54.0/24 28
BandWidth 4.21.126.0/24 28
BandWidth 65.125.25.64/26 28
BandWidth 208.23.64.0/25 28
BandWidth 2620:0:610::/48 28
BandWidth 2600:803:230::/48 28

Why 56 instead of 28? Feeling generous? What's the third Ferengi rule of acquisition?

Never spend more for an acquisition than you have to.

Per comments on the nginx version, you also want these v6's:

2620:0:610:: - 2620:0:610:FFFF:FFFF:FFFF:FFFF:FFFF (aka 2620:0:610::/48)
2600:803:230:: - 2600:803:230:FFFF:FFFF:FFFF:FFFF:FFFF (aka 2600:803:230::/48)

THANK YOU SO MUCH! I love you for this! (even though I never met you, but thanks anyways)

rjonesx commented

any chance for an apache 2.2 version - maybe with mod_security?

I am, sadly, also a 2.2 user. Sooo close!

Owner
m1 commented

Updated for 2.2. ( @bradchesney79 @rjonesx )

Done. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.