Created
November 7, 2011 21:03
-
-
Save inspire22/1346179 to your computer and use it in GitHub Desktop.
nginx rewrite for page_cached rails 3.1 assets redirect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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