This is done quite easily via the .htaccess file when running of FastCGI.
...
#maintenance section
RewriteCond %{REQUEST_FILENAME} !-f
#home ip is 123.123.123.123
RewriteCond %{REMOTE_HOST} !^123\.123\.123\.123
#office ip is 123.123.123.124
RewriteCond %{REMOTE_HOST} !^123\.123\.123\.124
RewriteRule $ /maintenance.html [R=302,L]
...
If I had to go into maintenance mode, I could just uncomment those couple of lines and it worked flawlessly. However, now that we've moved to a mongrel cluster the .htaccess file is ignored and I can't simply change the rewrite.I realize that if this were a permanent situation I could have HostingRails add it to the VHost file. However, this it the sort of thing that might be needed at random times for random intervals and that doesn't seem like the best solution.
Is there another way to easily accomplish this same thing?
I've thought about doing it programatically in Rails by uncommenting a before function that would serve a particular controller action if you weren't coming from the right address. I'm wary of that because I want to serve a 302 redirect code for any passing spiders.
Any ideas?