h1

FAILSAFE in my Rails production log

December 15, 2007

I’ll keep this one short and sweet. I was watching my production log and saw this:

/!\ FAILSAFE /!\ Sat Dec 15 19:48:06 -0800 2007
Status: 500 Internal Server Error
connect, accepted HTTP methods are delete, head, get, post, and put

I wondered what was going on, and after a check with the Apache log and Google, I found that the weird request was a CONNECT coming from freenode to make sure I didn’t have an abusable proxy or IIS. “What,” you say, “you’re running an IRC client on a Rails production server?” To that I say, “Yes.” Anyway, I stopped those requests from going to rails like this:

# First exclude some funky freenode port sniffing.
RewriteCond %{REQUEST_METHOD} !CONNECT
RewriteCond %{SERVER_NAME} teamdawg

That needs to be put before the line that finally redirects requests to your Mongrel cluster. (Of course you need to replace “teamdawg” in the second part with something that will match your own server name, or just leave the second part out.)

It occurs to me that maybe the “standard” Apache reverse proxy / rewriting config should have one additional condition before sending the request to the balancer. Most sample configs I have seen in blogs don’t have it:

RewriteCond %{REQUEST_METHOD} (GET|POST|PUT|HEAD|DELETE)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: