Categories
josephscott

Slashdot Protection

The ability for Slashdot to bring down sites that they link to has been well documented. This sort of thing is no longer limited to Slashdot, it seems Digg managed to do this pretty well also. So how does the average person protect themselves from the sudden onslaught of visitors? Mix Apache‘s mod_rewrite with the Coral Content Distribution Network and you get Slashdot protection.

Slashdot protection uses mod_rewrite to look at the referring websites (like Slashdot and Digg) of visitors and redirecting them to the Coral cached versions of your site:

Replace aaa.bbb.ccc.ddd with your own IP (so you always get to your site).
Replace www.yourdomain.com with your actual domain.

Just don’t mess with the user_agent and query_string lines. Those ensure that the Coral servers themselves can retrieve your page when they need to.

(Shamelessly stolen from http://ottodestruct.com/diggprotectionrules.txt)

RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^aaa.bbb.ccc.ddd$
RewriteCond %{HTTP_USER_AGENT} !^CoralWebPrx
RewriteCond %{QUERY_STRING} !(^|&)coral-no-serve$
RewriteCond %{HTTP_REFERER} ^http://(www.)?digg.com [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?slashdot.org [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?slashdot.com [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?fark.com [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?somethingawful.com [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?kuro5hin.org [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?engadget.com [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?boingboing.net [OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?del.icio.us
RewriteRule ^(.*)$ http://www.yourdomain.com.nyud.net:8080$1 [R,L]

In addition to the docs for mod_rewrite, you may want to check out the mod_rewrite cheat sheet.

via Gadgetopia

One reply on “Slashdot Protection”

Leave a Reply

Your email address will not be published. Required fields are marked *