Skip to content

Instantly share code, notes, and snippets.

@inspire22
Created November 7, 2011 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inspire22/1346179 to your computer and use it in GitHub Desktop.
Save inspire22/1346179 to your computer and use it in GitHub Desktop.
nginx rewrite for page_cached rails 3.1 assets redirect
I page_cache files with rails 3.1 - but with the new assets pipeline, old .css and .js files are removed at deployment, so the page_cached files point to broken versions.
Hacking it to keep old versions would be one solution, the other is to have nginx serve the current version of the assets file if it can't find the one requested:
location ~* ^/assets {
if (!-f $request_filename) {
rewrite ^/assets/(.*)-(.*)\.(.*) /assets/$1.$3 last;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment