Skip to content

Instantly share code, notes, and snippets.

@e-kolpakov
Created January 30, 2015 14:51
Show Gist options
  • Select an option

  • Save e-kolpakov/05e32a1d78627ea21476 to your computer and use it in GitHub Desktop.

Select an option

Save e-kolpakov/05e32a1d78627ea21476 to your computer and use it in GitHub Desktop.
location ~ ^/static/(?P<file>.*) {
root /edx/var/edxapp/;
try_files /staticfiles/$file /course_static/$file =404;
# return a 403 for static files that shouldn't be
# in the staticfiles directory
location ~ ^/static/(?:.*)(?:\.xml|\.json|README.TXT) {
return 403;
}
# http://www.red-team-design.com/firefox-doesnt-allow-cross-domain-fonts-by-default
location ~ "/static/(?P<collected>.*\.[0-9a-f]{12}\.(eot|otf|ttf|woff))" {
expires max;
try_files /staticfiles/$collected /course_static/$collected =404;
}
# Set django-pipelined files to maximum cache time
location ~ "/static/(?P<collected>.*\.[0-9a-f]{12}\..*)" {
expires max;
# Without this try_files, files that have been run through
# django-pipeline return 404s
try_files /staticfiles/$collected /course_static/$collected =404;
}
# Expire other static files immediately (there should be very few / none of these)
expires epoch;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment