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 ExpiresByType map #326

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
133 changes: 39 additions & 94 deletions h5bp/web_performance/cache_expiration.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Serve resources with a far-future expiration date.
#
# (!) If you don't control versioning with filename-based cache busting, you
# should consider lowering the cache times to something like one week.
# should consider lowering the cache times to something like one week.
#
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires
Expand All @@ -14,108 +14,53 @@
<IfModule mod_expires.c>

ExpiresActive on
ExpiresDefault "access plus 1 year"

# CSS

ExpiresByType text/css "access plus 1 year"


# Data interchange

ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType application/rdf+xml "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 hour"

ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/ld+json "access plus 0 seconds"
ExpiresByType application/schema+json "access plus 0 seconds"
ExpiresByType application/geo+json "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType text/calendar "access plus 0 seconds"
ExpiresByType text/xml "access plus 0 seconds"

# Default: Fallback
ExpiresDefault "access plus 1 year"

# Favicon (cannot be renamed!) and cursor images

# Specific: Assets
ExpiresByType image/vnd.microsoft.icon "access plus 1 week"
ExpiresByType image/x-icon "access plus 1 week"

# HTML

ExpiresByType text/html "access plus 0 seconds"


# JavaScript

ExpiresByType application/javascript "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"


# Manifest files

# Specific: Manifests
ExpiresByType application/manifest+json "access plus 1 week"
ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
ExpiresByType text/cache-manifest "access plus 0 seconds"


# Markdown

ExpiresByType text/markdown "access plus 0 seconds"


# Media files

ExpiresByType audio/ogg "access plus 1 year"
ExpiresByType image/apng "access plus 1 year"
ExpiresByType image/avif "access plus 1 year"
ExpiresByType image/bmp "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/jxl "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType video/mp4 "access plus 1 year"
ExpiresByType video/ogg "access plus 1 year"
ExpiresByType video/webm "access plus 1 year"


# WebAssembly

ExpiresByType application/wasm "access plus 1 year"


# Web fonts

# Collection
ExpiresByType font/collection "access plus 1 year"

# Embedded OpenType (EOT)
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType font/eot "access plus 1 year"

# OpenType
ExpiresByType font/opentype "access plus 1 year"
ExpiresByType font/otf "access plus 1 year"

# TrueType
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType font/ttf "access plus 1 year"

# Web Open Font Format (WOFF) 1.0
ExpiresByType application/font-woff "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"

# Web Open Font Format (WOFF) 2.0
ExpiresByType application/font-woff2 "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType application/x-web-app-manifest+json "access"
ExpiresByType text/cache-manifest "access"

# Specific: Data interchange
ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType application/rdf+xml "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 hour"

# Other
# Specific: Documents
ExpiresByType text/html "access"
ExpiresByType text/markdown "access"
ExpiresByType text/calendar "access"

# Specific: Other
ExpiresByType text/x-cross-domain-policy "access plus 1 week"

# Generic: Data
ExpiresByType application/json "access"
ExpiresByType application/ld+json "access"
ExpiresByType application/schema+json "access"
ExpiresByType application/geo+json "access"
ExpiresByType application/xml "access"
ExpiresByType text/xml "access"

# Generic: WebAssembly
# ExpiresByType application/wasm "access plus 1 year" # default

# Generic: Assets
# ExpiresByType application/javascript "access plus 1 year" # default
# ExpiresByType application/x-javascript "access plus 1 year" # default
# ExpiresByType text/javascript "access plus 1 year" # default
# ExpiresByType text/css "access plus 1 year" # default

# Generic: Medias
# ExpiresByType audio/* "access plus 1 year" # default
# ExpiresByType image/* "access plus 1 year" # default
# ExpiresByType video/* "access plus 1 year" # default
# ExpiresByType font/* "access plus 1 year" # default

</IfModule>