Bad Behavior blocks access to WordPress site when using GlimmerBlocker

I absolutely love GlimmerBlocker. GlimmerBlocker is a free ad filter proxy, primarily targeted at Safari users. It filters those annoying ads on ad polluted websites very effectively. But wait, GlimmerBlocker is more! It supports Safari keyword expansions for quick searches using Safari’s address bar. Imagine you’re looking for more information about, let’s say, Paruresis. Once GlimmerBlocker is activated, you could just type

wiki paruresis

in Safari’s address bar. Ain’t that cool?  This is how you search for a GPS receiver for your D700 on eBay:

ebay gps nikon d700

Voilà, there you have it! There are many more keywords like flickr, YouTube, Unix man pages, Hulu, IMDb and more.

GlimmerBlocker & Bad Behavior plugin

Even though I’m using Akismet on my WordPress blog, I’m still receiving a considerable amount of spam comments every day. Akismet does a good job recognizing most spam comments but I always have to check through them and move them to the trash. One way to further reduce blog comment spam is to install the Bad Behavior plugin for WordPress. The plugin uses advanced comment spam detection techniques and IP address data about notorious comment spammers collected by Project Honeypot. Once a certain threat threshold is reached, the alleged comment spammer is denied from sending HTTP post requests to a WordPress site. When used together, Akismet and Bad Behavior are able to reduce the amount of daily spam comments to (almost) zero!

There’s just one problem when using GlimmerBlocker on the Mac and the Bad Behavior plugin on a WordPress site: you won’t be able make changes to the site anymore. You won’t even be able to login anymore. Instead, you’ll get an error message like this whenever you try to send a HTTP post request to your blog:

Error 400

An invalid request was received. This may be caused by a malfunctioning
proxy server. Bypass the proxy server and connect directly, or contact
your proxy server administrator.

Your technical support key is: 5505-57b3-41fe-ed15

The reason why the request was denied by Bad Behavior is:
Header ‘Pragma’ without ‘Cache-Control’ prohibited for HTTP/1.1 requests

I contacted Peter Speck from GlimmerBlocker.org and he was nice enough to send me a custom rule that modifies the caching instructions in the HTTP header. You have to add a new filter set on the Filters tab in GlimmerBlocker. I named it “Cache-Control for Bad Behavior”. Now just paste the following rule to the Rules area in the same tab and you’re all set!

<?xml version="1.0" encoding="UTF-8"?>
<glimmerblocker-rules>
   <rule priority="3" type="request">
       <request language="js" version="1"><![CDATA[//gb.log("p: %o", gb.request.headers['Pragma']);
//gb.log("cc: %o", gb.request.headers['Cache-Control']);
if (gb.request.headers['Pragma'] && !gb.request.headers['Cache-Control'])
       gb.request.headers['Cache-Control'] = 'no-cache';]]></request>
   </rule>
</glimmerblocker-rules>