Skip to content

Instantly share code, notes, and snippets.

@annez
Created March 25, 2019 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save annez/64f6c2e3982f99798055eb91cd8eed07 to your computer and use it in GitHub Desktop.
Save annez/64f6c2e3982f99798055eb91cd8eed07 to your computer and use it in GitHub Desktop.
Fastly Brotli
# We explicitly ignore "application/json" due to some clients (Ruby, Node) not supporting BR so if you fetch internally from Fastly you'll get uncompressed content
sub vcl_recv {
if (req.http.Fastly-Orig-Accept-Encoding) {
if (req.http.Fastly-Orig-Accept-Encoding ~ "br" && req.http.Content-type !~ "application/json") {
set req.http.Accept-Encoding = "br";
} elsif (req.http.Fastly-Orig-Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} else {
unset req.http.Accept-Encoding;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment