Update default.vcl

add brotli compession
This commit is contained in:
Olivier DEBAUCHE authored and GitHub committed 2021-06-17 21:42:25 +02:00
1 parent 165a359686
commit a8d3046ebb
1 file changed
+21
+21
View File
@@ -11,6 +11,27 @@ sub vcl_recv {
#
# Typically you clean up the request here, removing cookies you don't need,
# rewriting the request, etc.
if(req.http.Accept-Encoding ~ "br" && req.url !~
"\.(jpg|png|gif)$") {
set req.http.X-brotli = "true";
}
}
sub vcl_hash
{
if(req.http.X-brotli == "true") {
hash_data("brotli");
}
}
sub vcl_backend_fetch
{
if(bereq.http.X-brotli == "true") {
set bereq.http.Accept-Encoding = "br";
unset bereq.http.X-brotli;
}
}
sub vcl_backend_response {