Hosting a Downtime Page with Apache

I had to help set up a downtime page for a site experiencing an extended outage. We wanted a “We’re working on it!” type page to let people know what it would be back up soon. But the problem is that if you serve this as a static HTML page, it would (a) only work on the site’s root page, and (b) be served with an HTTP 200 status code, potentially getting crawled by search engines and ending up in peoples’ caches. Both of those are bad.

What I really wanted was to set an HTTP status code that indicated that there was an error condition, so that browsers would hopefully not cache the page, and so that search engines would know not to index the page contents. HTTP 503 works perfectly for this — “Service Unavailable.”

I ended up setting up a new Apache virtual host on my existing server (not the one that’s down, of course), creating a quick page named downtime.html (the only content), and throwing together the .htaccess (assembled piecemeal from some reference sites, admittedly):

RewriteCond %{ENV:REDIRECT_STATUS} !=503
RewriteRule !^/downtime.html$ /downtime.html [L,R=503]
ErrorDocument 503 /downtime.html

The result is that all pages on the site now get the downtime page in response, served with the appropriate HTTP status code. Ta-da! This isn’t anything terribly involved, of course, but figuring out how to set a 503 via mod_rewrite was quite confounding.

The Strangely Interesting Tale of HavenCo’s Demise

I remember reading about HavenCo ages ago, a hosting company based in Sealand, a small structure (build for World War 2 and subsequently abandoned) in ostensibly-international waters off the coast of England. The idea was for it to be an offshore data haven, hosting everything legal in Sealand — which, being a small abandoned structure in the middle of the ocean, did not have particularly onerous copyright restrictions.

While intriguing at the time, I hadn’t heard about HavenCo for ages and it had faded from memory. The other day I happened across a fascinating article on Ars Technica, Death of a data haven: cypherpunks, WikiLeaks, and the world’s smallest nation. It’s a long, but absolutely worthwhile read, outlining HavenCo’s history, what went wrong, and its mark on history and the quest for freedom.

Incidentally, for further reading, Ryan Lackey has a 2003 DefCon presentation entitled HavenCo: What really happened, which offers a candid look from the perspective of HavenCo’s founder.

Incidentally, the most interesting follow-up I can find about what Lackey is up to these days comes from Blood, Bullets, Bombs, and Bandwidth, detailing an ISP providing Internet service in Iraq. (The article is undated, but possibly circa 2007.)