Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorder and improve expires map #324

Merged
merged 1 commit into from
Dec 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 31 additions & 44 deletions h5bp/web_performance/cache_expiration.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,65 +12,52 @@
# https://nginx.org/en/docs/http/ngx_http_headers_module.html#expires

map $sent_http_content_type $expires {
# Default: Fallback
default 1y;

# No content
# Default: No content
"" off;

# CSS
~*text/css 1y;

# Data interchange
~*application/atom\+xml 1h;
~*application/rdf\+xml 1h;
~*application/rss\+xml 1h;

~*application/json epoch;
~*application/ld\+json epoch;
~*application/schema\+json epoch;
~*application/geo\+json epoch;
~*application/xml epoch;
~*text/calendar epoch;
~*text/xml epoch;

# Favicon (cannot be renamed!) and cursor images
# Specific: Assets
~*image/svg\+xml 1y;
~*image/vnd.microsoft.icon 1w;
~*image/x-icon 1w;

# HTML
~*text/html epoch;

# JavaScript
~*application/javascript 1y;
~*application/x-javascript 1y;
~*text/javascript 1y;

# Manifest files
# Specific: Manifests
~*application/manifest\+json 1w;
~*application/x-web-app-manifest\+json epoch;
~*text/cache-manifest epoch;

# Markdown
# Specific: Data interchange
~*application/atom\+xml 1h;
~*application/rdf\+xml 1h;
~*application/rss\+xml 1h;

# Specific: Documents
~*text/html epoch;
~*text/markdown epoch;
~*text/calendar epoch;

# Specific: Other
~*text/x-cross-domain-policy 1w;

# Media files
~*audio/ 1y;
~*image/ 1y;
~*video/ 1y;
# Generic: Data
~*json epoch;
~*xml epoch;

# WebAssembly
~*application/wasm 1y;
# Generic: WebAssembly
# ~*application/wasm 1y; # default

# Web fonts
~*font/ 1y;
~*application/vnd.ms-fontobject 1y;
~*application/x-font-ttf 1y;
~*application/x-font-woff 1y;
~*application/font-woff 1y;
~*application/font-woff2 1y;
# Generic: Assets
# ~*application/javascript 1y; # default
# ~*application/x-javascript 1y; # default
# ~*text/javascript 1y; # default
# ~*text/css 1y; # default

# Other
~*text/x-cross-domain-policy 1w;
# Generic: Medias
# ~*audio/ 1y; # default
# ~*image/ 1y; # default
# ~*video/ 1y; # default
# ~*font/ 1y; # default
}

expires $expires;