Skip to content

Commit f62529b

Browse files
committed
MAGETWO-31196: ETag support on frontend, expiration/lifetime management
1 parent 0b130ab commit f62529b

File tree

1 file changed

+71
-27
lines changed

1 file changed

+71
-27
lines changed

.htaccess

Lines changed: 71 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,63 @@
6161
SecFilterScanPOST Off
6262
</IfModule>
6363

64+
############################################
65+
## setting MIME types
66+
67+
# JavaScript
68+
AddType application/javascript js jsonp
69+
AddType application/json json
70+
71+
# CSS
72+
AddType text/css css
73+
74+
# Images and icons
75+
AddType image/x-icon ico
76+
AddType image/gif gif
77+
AddType image/png png
78+
AddType image/jpeg jpg
79+
AddType image/jpeg jpeg
80+
81+
# SVG
82+
AddType image/svg+xml svg
83+
84+
# Fonts
85+
AddType application/vnd.ms-fontobject eot
86+
AddType application/x-font-ttf ttf
87+
AddType application/x-font-otf otf
88+
AddType application/x-font-woff woff
89+
AddType application/font-woff2 woff2
90+
91+
# Flash
92+
AddType application/x-shockwave-flash swf
93+
94+
# Archives and exports
95+
AddType application/zip gzip
96+
AddType application/x-gzip gz gzip
97+
AddType application/x-bzip2 bz2
98+
AddType text/csv csv
99+
AddType application/xml xml
100+
64101
<IfModule mod_headers.c>
65102
############################################
66103
## prevent clickjacking
67104

68105
Header set X-Frame-Options SAMEORIGIN
106+
107+
Header append Cache-Control no-cache
108+
109+
<FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|htm)$>
110+
Header append Cache-Control public
111+
</FilesMatch>
112+
113+
<FilesMatch .*\.(zip|gz|gzip|bz2|csv|xml)$>
114+
Header append Cache-Control no-store
115+
</FilesMatch>
116+
117+
<FilesMatch ".(html)$">
118+
Header append Vary: Accept-Encoding
119+
</FilesMatch>
120+
69121
</IfModule>
70122

71123
<IfModule mod_deflate.c>
@@ -166,53 +218,46 @@
166218
## Add default Expires header
167219
## http://developer.yahoo.com/performance/rules.html#expires
168220

169-
<FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|js|css|swf|ttf|otf|woff|woff2|ogg|mp4|webm)$>
170-
Header append Cache-Control private
171-
</FilesMatch>
172-
173221
ExpiresActive On
174222

175-
<FilesMatch \.(html|xhtml|xml|shtml|phtml|php|txt)$>
223+
# Data
224+
<FilesMatch \.(html|xhtml|shtml|phtml|php|txt|zip|gz|gzip|bz2|csv|xml)$>
176225
ExpiresDefault "access plus 0 seconds"
177226
</FilesMatch>
178-
179227
ExpiresByType text/html "access plus 0 seconds"
180-
181-
# Data
182228
ExpiresByType text/xml "access plus 0 seconds"
183-
ExpiresByType application/xml "access plus 0 seconds"
229+
ExpiresByType text/csv "access plus 0 seconds"
184230
ExpiresByType application/json "access plus 0 seconds"
231+
ExpiresByType application/zip "access plus 0 seconds"
232+
ExpiresByType application/x-gzip "access plus 0 seconds"
233+
ExpiresByType application/x-bzip2 "access plus 0 seconds"
234+
235+
# CSS, JavaScript
236+
<FilesMatch \.(css|js)$>
237+
ExpiresDefault "access plus 1 year"
238+
</FilesMatch>
239+
ExpiresByType text/css "access plus 1 year"
240+
ExpiresByType application/javascript "access plus 1 year"
185241

186-
# MFavicon, images, video, audio
187-
<FilesMatch \.(ico|gif|png|jpg|jpeg|ogg|mp4|mkv|flv|swf|wmv|asf|asx|wma|wax|wmx|wm)$>
242+
# Favicon, images, flash
243+
<FilesMatch \.(ico|gif|png|jpg|jpeg|swf|svg)$>
188244
ExpiresDefault "access plus 1 year"
189245
</FilesMatch>
190246
ExpiresByType image/gif "access plus 1 year"
191247
ExpiresByType image/png "access plus 1 year"
192248
ExpiresByType image/jpg "access plus 1 year"
193249
ExpiresByType image/jpeg "access plus 1 year"
194-
ExpiresByType image/svg "access plus 1 year"
195-
ExpiresByType video/ogg "access plus 1 year"
196-
ExpiresByType audio/ogg "access plus 1 year"
197-
ExpiresByType video/mp4 "access plus 1 year"
198-
ExpiresByType video/webm "access plus 1 year"
250+
ExpiresByType image/svg+xml "access plus 1 year"
199251

200252
# Fonts
201253
<FilesMatch \.(eot|ttf|otf|svg|woff|woff2)$>
202254
ExpiresDefault "access plus 1 year"
203255
</FilesMatch>
256+
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
204257
ExpiresByType application/x-font-ttf "access plus 1 year"
205-
ExpiresByType font/opentype "access plus 1 year"
258+
ExpiresByType application/x-font-otf "access plus 1 year"
206259
ExpiresByType application/x-font-woff "access plus 1 year"
207-
ExpiresByType image/svg+xml "access plus 1 year"
208-
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
209-
210-
# CSS, JavaScript
211-
<FilesMatch \.(css|js)$>
212-
ExpiresDefault "access plus 1 year"
213-
</FilesMatch>
214-
ExpiresByType text/css "access plus 1 year"
215-
ExpiresByType application/javascript "access plus 1 year"
260+
ExpiresByType application/font-woff2 "access plus 1 year"
216261

217262
</IfModule>
218263

@@ -234,4 +279,3 @@
234279
## http://developer.yahoo.com/performance/rules.html#etags
235280

236281
#FileETag none
237-
#FileETag MTime Size

0 commit comments

Comments
 (0)