Stuff Nobody Cares About

The soul...
The feeds...
The links...
Wednesday Jun 17, 2009

Blocking blog spam with Lighttpd.

I've switched to "Lighty" (lighttpd) for my website, and a good part of the reason is because I like the configuration file syntax. However, I didn't quite realize at the time just how much spam was being blocked by my "no referer means no POST" rule in Apache.

Fortunately, I've figured out how to do the same in Lighty, thanks to nested conditionals, which are new in Lighttpd 1.4 - included in Sun's Webstack:


$HTTP["host"] == "blugh.bofh.ca" {
$HTTP["request-method"] == "POST" {
$HTTP["referer"] == "" {
url.access-deny = ( "" )
}
}
}

IF the host is "blugh.bofh.ca" AND IF "request-method" is "POST" then you'd better have a referer. That'll do the job for now... I'm sure some enterprising spammer might adapt his code to supply a referer of any sort, but then he'll just get stopped by my own moderation... they can feel free to waste their time for no benefit. I encourage it!

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed