Skip to content

Commit 91f3c7a

Browse files
ENGCOM-8925: Add WEBP + AVIF Support by default #32400
- Merge Pull Request #32400 from in-session/magento2:2.4-develop - Merged commits: 1. 59a5e8d 2. f578f02 3. 59161f2 4. 81882e7 5. 73f6c3f 6. 7e4e074 7. 760ab36 8. 1e5cf5b 9. c4bc0c1 10. c3f7262 11. 28f539b 12. 27c93ab 13. 8f4e06f 14. 9993844 15. d2bd6cf 16. d265e96 17. 203dbf4 18. 73c94d4 19. c416e6b 20. b877a4a 21. 3530c6c 22. ea1f90a 23. 9c8c61b 24. 8960823 25. 9d778c8 26. 8313833 27. de5c558 28. 5188dcf 29. 22643ae
2 parents 8b56d34 + 22643ae commit 91f3c7a

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed

nginx.conf.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ location /static/ {
112112
rewrite ^/static/version\d*/(.*)$ /static/$1 last;
113113
}
114114

115-
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|html|json)$ {
115+
location ~* \.(ico|jpg|jpeg|png|gif|svg|svgz|webp|avif|avifs|js|css|eot|ttf|otf|woff|woff2|html|json|webmanifest)$ {
116116
add_header Cache-Control "public";
117117
add_header X-Frame-Options "SAMEORIGIN";
118118
expires +1y;
@@ -166,7 +166,7 @@ location /media/ {
166166
deny all;
167167
}
168168

169-
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
169+
location ~* \.(ico|jpg|jpeg|png|gif|svg|svgz|webp|avif|avifs|js|css|eot|ttf|otf|woff|woff2)$ {
170170
add_header Cache-Control "public";
171171
add_header X-Frame-Options "SAMEORIGIN";
172172
expires +1y;

pub/media/.htaccess

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ AddType image/gif gif
5252
AddType image/png png
5353
AddType image/jpeg jpg
5454
AddType image/jpeg jpeg
55+
AddType image/webp webp
56+
AddType image/avif avif
57+
AddType image/avif-sequence avifs
5558

5659
# SVG
57-
AddType image/svg+xml svg
60+
AddType image/svg+xml svg svgz
5861

5962
# Fonts
6063
AddType application/vnd.ms-fontobject eot
@@ -63,9 +66,6 @@ AddType application/x-font-otf otf
6366
AddType application/x-font-woff woff
6467
AddType application/font-woff2 woff2
6568

66-
# Flash
67-
AddType application/x-shockwave-flash swf
68-
6969
# Archives and exports
7070
AddType application/zip gzip
7171
AddType application/x-gzip gz gzip
@@ -75,7 +75,7 @@ AddType application/xml xml
7575

7676
<IfModule mod_headers.c>
7777

78-
<FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$>
78+
<FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|svgz|webp|avif|avifs|js|css|eot|ttf|otf|woff|woff2)$>
7979
Header append Cache-Control public
8080
</FilesMatch>
8181

@@ -111,15 +111,18 @@ AddType application/xml xml
111111
ExpiresByType text/css "access plus 1 year"
112112
ExpiresByType application/javascript "access plus 1 year"
113113

114-
# Favicon, images, flash
115-
<FilesMatch \.(ico|gif|png|jpg|jpeg|swf|svg)$>
114+
# Favicon, images
115+
<FilesMatch \.(ico|gif|png|jpg|jpeg|svg|svgz|webp|avif|avifs)$>
116116
ExpiresDefault "access plus 1 year"
117117
</FilesMatch>
118118
ExpiresByType image/gif "access plus 1 year"
119119
ExpiresByType image/png "access plus 1 year"
120120
ExpiresByType image/jpg "access plus 1 year"
121121
ExpiresByType image/jpeg "access plus 1 year"
122122
ExpiresByType image/svg+xml "access plus 1 year"
123+
ExpiresByType image/webp "access plus 1 year"
124+
ExpiresByType image/avif "access plus 1 year"
125+
ExpiresByType image/avif-sequence "access plus 1 year"
123126

124127
# Fonts
125128
<FilesMatch \.(eot|ttf|otf|svg|woff|woff2)$>

pub/static/.htaccess

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ AddType application/javascript js jsonp
3737
AddType application/json json
3838

3939
# HTML
40-
4140
AddType text/html html
4241

4342
# CSS
@@ -49,9 +48,12 @@ AddType image/gif gif
4948
AddType image/png png
5049
AddType image/jpeg jpg
5150
AddType image/jpeg jpeg
51+
AddType image/webp webp
52+
AddType image/avif avif
53+
AddType image/avif-sequence avifs
5254

5355
# SVG
54-
AddType image/svg+xml svg
56+
AddType image/svg+xml svg svgz
5557

5658
# Fonts
5759
AddType application/vnd.ms-fontobject eot
@@ -60,8 +62,8 @@ AddType application/x-font-otf otf
6062
AddType application/x-font-woff woff
6163
AddType application/font-woff2 woff2
6264

63-
# Flash
64-
AddType application/x-shockwave-flash swf
65+
# Manifest
66+
AddType application/manifest+json webmanifest
6567

6668
# Archives and exports
6769
AddType application/zip gzip
@@ -72,7 +74,7 @@ AddType application/xml xml
7274

7375
<IfModule mod_headers.c>
7476

75-
<FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|html|json)$>
77+
<FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|webp|avif|avifs|js|css|eot|ttf|otf|woff|woff2|html|json|webmanifest)$>
7678
Header append Cache-Control public
7779
</FilesMatch>
7880

@@ -100,6 +102,12 @@ AddType application/xml xml
100102
ExpiresByType application/zip "access plus 0 seconds"
101103
ExpiresByType application/x-gzip "access plus 0 seconds"
102104
ExpiresByType application/x-bzip2 "access plus 0 seconds"
105+
106+
# Manifest
107+
<FilesMatch \.(webmanifest)$>
108+
ExpiresDefault "access plus 0 seconds"
109+
</FilesMatch>
110+
ExpiresByType application/manifest+json "access plus 0 seconds"
103111

104112
# CSS, JavaScript, html
105113
<FilesMatch \.(css|js|html|json)$>
@@ -111,14 +119,17 @@ AddType application/xml xml
111119
ExpiresByType application/json "access plus 1 year"
112120

113121
# Favicon, images, flash
114-
<FilesMatch \.(ico|gif|png|jpg|jpeg|swf|svg)$>
122+
<FilesMatch \.(ico|gif|png|jpg|jpeg|svg|svgz|webp|avif|avifs)$>
115123
ExpiresDefault "access plus 1 year"
116124
</FilesMatch>
117125
ExpiresByType image/gif "access plus 1 year"
118126
ExpiresByType image/png "access plus 1 year"
119127
ExpiresByType image/jpg "access plus 1 year"
120128
ExpiresByType image/jpeg "access plus 1 year"
121129
ExpiresByType image/svg+xml "access plus 1 year"
130+
ExpiresByType image/webp "access plus 1 year"
131+
ExpiresByType image/avif "access plus 1 year"
132+
ExpiresByType image/avif-sequence "access plus 1 year"
122133

123134
# Fonts
124135
<FilesMatch \.(eot|ttf|otf|svg|woff|woff2)$>
@@ -129,5 +140,7 @@ AddType application/xml xml
129140
ExpiresByType application/x-font-otf "access plus 1 year"
130141
ExpiresByType application/x-font-woff "access plus 1 year"
131142
ExpiresByType application/font-woff2 "access plus 1 year"
143+
ExpiresByType font/opentype "access plus 1 year"
144+
ExpiresByType font/truetype "access plus 1 year"
132145

133146
</IfModule>

0 commit comments

Comments
 (0)