Skip to content

Instantly share code, notes, and snippets.

@desheikh
Created December 9, 2014 23:10
Show Gist options
  • Save desheikh/bd1a1d55c8452e9d5537 to your computer and use it in GitHub Desktop.
Save desheikh/bd1a1d55c8452e9d5537 to your computer and use it in GitHub Desktop.
redirect missing rails digested asset paths in nginx to a non digested version
location ~* ^\/assets\/(?:.*\/)?([\w-]+)-[0-9a-f]+\.(ico|css|js|gif|jpe?g|png)$ {
try_files $uri @missing_image;
}
location @missing_image {
rewrite ^\/assets(.*)-[0-9a-f]+(\.\w+)$ /assets$1$2 permanent;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment