Skip to content

Commit d65cd97

Browse files
markwoonLeoColomb
andcommitted
Use regexp in MIME-types based maps (#221)
Fix #220 Co-authored-by: Léo Colombaro <git@colombaro.fr>
1 parent 50a6d79 commit d65cd97

1 file changed

Lines changed: 34 additions & 48 deletions

File tree

h5bp/web_performance/cache_expiration.conf

Lines changed: 34 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,76 +13,62 @@
1313
# https://nginx.org/en/docs/http/ngx_http_headers_module.html#expires
1414

1515
map $sent_http_content_type $expires {
16-
default 1M;
16+
default 1M;
1717

1818
# CSS
19-
text/css 1y;
19+
~*text/css 1y;
2020

2121
# Data interchange
22-
application/atom+xml 1h;
23-
application/rdf+xml 1h;
24-
application/rss+xml 1h;
25-
26-
application/json 0;
27-
application/ld+json 0;
28-
application/schema+json 0;
29-
application/geo+json 0;
30-
application/xml 0;
31-
text/calendar 0;
32-
text/xml 0;
22+
~*application/atom+xml 1h;
23+
~*application/rdf+xml 1h;
24+
~*application/rss+xml 1h;
25+
26+
~*application/json 0;
27+
~*application/ld+json 0;
28+
~*application/schema+json 0;
29+
~*application/geo+json 0;
30+
~*application/xml 0;
31+
~*text/calendar 0;
32+
~*text/xml 0;
3333

3434
# Favicon (cannot be renamed!) and cursor images
35-
image/vnd.microsoft.icon 1w;
36-
image/x-icon 1w;
35+
~*image/vnd.microsoft.icon 1w;
36+
~*image/x-icon 1w;
3737

3838
# HTML
39-
text/html 0;
39+
~*text/html 0;
4040

4141
# JavaScript
42-
application/javascript 1y;
43-
application/x-javascript 1y;
44-
text/javascript 1y;
42+
~*application/javascript 1y;
43+
~*application/x-javascript 1y;
44+
~*text/javascript 1y;
4545

4646
# Manifest files
47-
application/manifest+json 1w;
48-
application/x-web-app-manifest+json 0;
49-
text/cache-manifest 0;
50-
47+
~*application/manifest+json 1w;
48+
~*application/x-web-app-manifest+json 0;
49+
~*text/cache-manifest 0;
5150

5251
# Markdown
53-
text/markdown 0;
52+
~*text/markdown 0;
5453

5554
# Media files
56-
audio/ogg 1M;
57-
image/bmp 1M;
58-
image/gif 1M;
59-
image/jpeg 1M;
60-
image/png 1M;
61-
image/svg+xml 1M;
62-
image/webp 1M;
63-
video/mp4 1M;
64-
video/ogg 1M;
65-
video/webm 1M;
55+
~*audio/.* 1M;
56+
~*image/.* 1M;
57+
~*video/.* 1M;
6658

6759
# WebAssembly
68-
application/wasm 1y;
60+
~*application/wasm 1y;
6961

7062
# Web fonts
71-
font/collection 1M;
72-
application/vnd.ms-fontobject 1M;
73-
font/eot 1M;
74-
font/opentype 1M;
75-
font/otf 1M;
76-
application/x-font-ttf 1M;
77-
font/ttf 1M;
78-
application/font-woff 1M;
79-
application/x-font-woff 1M;
80-
font/woff 1M;
81-
application/font-woff2 1M;
82-
font/woff2 1M;
63+
~*font/.* 1M;
64+
~*application/vnd.ms-fontobject 1M;
65+
~*application/x-font-ttf 1M;
66+
~*application/x-font-woff 1M;
67+
~*application/font-woff 1M;
68+
~*application/font-woff2 1M;
8369

8470
# Other
85-
text/x-cross-domain-policy 1w;
71+
~*text/x-cross-domain-policy 1w;
8672
}
8773

8874
expires $expires;

0 commit comments

Comments
 (0)