Sunday, October 28, 2007
Better Capistrano Rewrite Rule for Maintenance Page
Capistrano comes with a nice little tasked called deploy:web:disable that puts up a maintenance page on your site. Assuming your webserver detects the presence of this page and rewrites any requests to display that page, this effectively disables your site. Very handy.I found that the common configuration available on the Internet didn't work for me. Specifically, the Apache Rewrite rule needs to reference DOCUMENT_ROOT. Here are my rewrite rules; remember that for this to work, they have to be first:
Labels: capistrano, rails


2 Comments:
I like to slap in a line to let through css + images too, so maintenance pages can be a bit pretty. I put the following just before your lines above:
RewriteCond %{REQUEST_URI} !\.(css|jpg|png|gif)$
That's very timely Dr. Nic, as I was just today about to code a custom maintenance page and I'm sure that would have tripped me up. Thanks!
Post a Comment
Links to this post:
Create a Link
<< Home