Capistrano and Passenger Part 2

As Karl Varga pointed out in his comment on my previous post on Capistrano and Passenger (here) my apache rewrite rules did not send back the proper HTTP status codes. Now with the improved and tested rules the 503 status code is returned.

1
2
3
4
5
6
7
8
9
ErrorDocument 503 /system/maintenance.html

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
# RewriteCond %{REQUEST_URI} !^/images/
# RewriteCond %{REQUEST_URI} !^/robots.txt
# RewriteCond %{REQUEST_URI} !^/sitemap
RewriteRule ^.*$ [redirect=503,last]

If your maintenance page has images on it than you can enable line 6 by removing the ‘#’.

See also Chris K’s article.

Comments

Copyright © 2013 - Tom Pesman - Powered by Octopress