Skip to content

Commit de57a20

Browse files
committed
Add support for Brotli static compression
1 parent e700354 commit de57a20

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

etc/vcl_snippets/fetch.vcl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
if (!beresp.http.Vary ~ "Accept-Encoding") {
5353
set beresp.http.Vary:Accept-Encoding = "";
5454
}
55-
if (req.http.Accept-Encoding == "gzip") {
55+
if (req.http.Accept-Encoding == "br") {
56+
set beresp.brotli = true;
57+
} else if (req.http.Accept-Encoding == "gzip") {
5658
set beresp.gzip = true;
5759
}
5860
}

etc/vcl_snippets/recv.vcl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@
106106
set req.http.Https = "on";
107107
}
108108

109+
# Add support for Brotli static compression
110+
if (req.http.Fastly-Orig-Accept-Encoding) {
111+
if (req.http.Fastly-Orig-Accept-Encoding ~ "\bbr\b") {
112+
set req.http.Accept-Encoding = "br";
113+
}
114+
}
115+
109116
if (fastly.ff.visits_this_service > 0) {
110117
# disable ESI processing on Origin Shield
111118
set req.esi = false;

0 commit comments

Comments
 (0)