#
# Client Cache Control
#

#
# Expire rules for static content
# Do not use a default expire rule with nginx unless a site is completely static

# cache.appcache, your document html and data
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
    expires -1;
}

# Feed
location ~* \.(?:rss|atom)$ {
    expires 1h;
    add_header Cache-Control "public";
}

# Compressed Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|gz|svgz|mp3|mp4|ogg|ogv|webm|htc)$ {
    gzip off;
    expires 1M;
    add_header Cache-Control "public";
}

# Uncompressed Media: images, icons, video, audio, HTC
location ~* \.(?:ico|cur|svg|webm|htc|mid|midi|wav|bmp)$ {
    expires 1M;
    add_header Cache-Control "public";
}

# CSS and Javascript
location ~* \.(?:css|js)$ {
    expires 1y;
    add_header Cache-Control "public";
}

# WebFonts
# If you are NOT using cross-domain-fonts, uncomment the following directive
location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
    expires 1y;
    add_header Cache-Control "public";
    add_header  Access-Control-Allow-Origin "*" ;
}

# Compressed Archives
location ~* \.(?:zip|tgz|gz|rar|bz2|deb|rar)$ {
    gzip off;
    expires 1M;
    add_header Cache-Control "public";
}

# Uncompressed Archives
location ~* \.(?:tar|exe)$ {
    expires 1M;
    add_header Cache-Control "public";
}

# Documents
location ~* \.(?:doc|xls|pfd|ppt|rtf|rst|tex)$ {
    expires 1M;
    add_header Cache-Control "public";
}

#
# Filename-based cache busting
# Route all requests for /css/style.20120716.css to /css/style.css
# github.com/h5bp/html5-boilerplate/wiki/cachebusting
#location ~* (.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif)$ {
#    try_files $uri $1.$2;
#}
