Created
March 25, 2019 08:54
-
-
Save annez/64f6c2e3982f99798055eb91cd8eed07 to your computer and use it in GitHub Desktop.
Fastly Brotli
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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