maintenance page with 3.1 and assets pipeline

Prior to 3.1/pipeline, adding a maintenance page was as simple as dropping a file in place on the server, and a apache rewrite rule.

Now... all my assets are dynamic. So the files that are referenced by my static maintenance.html file change, and break.

Has anyone come across a nice solution for presenting a maintenance page during deploy?

If you use Rails 3.1.1, it will by default add non-digested assets in addition to the digest ones. So in static pages, you can just refer to the non-digest asset filenames, and they should be consistent.

-GR

I currently have this snippet in my Apache sites-available file to enable

Far future expiration:

ExpiresActive on

<FilesMatch “.(js|css|gif|png|jpg)$”>

ExpiresDefault “access plus 1 week”

SetOutputFilter Deflate

When using these non-digest asset filenames, I believe there is a risk the cache

could be “frozen” on old versions.

Should the non-digest asset filenames not be marked in a special way or stored in a

special directory to make it easier to exclude them from far future expiration?

Or is there an easy way to improve my configuration to only do far future expiration

on digested asset filenames?

Thanks,

Peter

Well, and this is off the top of my head and totally untested, you could change your apache config to something like

<LocationMatch “^/assets/.-[0-9a-f]{32}.$”>

That should just match files in the assets directory that have a 32-character digest, and not match un-digested files…

-GR