  # static pages for server status
  location ~ ^/server/(?P<file>.*) {
      root /edx/var/nginx/server-static;
      try_files /$file =404;
  }

  location ~ ^/static/(?P<file>.*) {
    root {{ edxapp_data_dir }};
    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;
        add_header Access-Control-Allow-Origin *;
        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;
    }

    # Set django-pipelined files for studio to maximum cache time
    location ~ "/static/(?P<collected>[0-9a-f]{7}/.*)" {
        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;
  }


