Update default.vcl

add brotli compession
This commit is contained in:
Olivier DEBAUCHE 2021-06-17 21:42:25 +02:00 committed by GitHub
parent 165a359686
commit a8d3046ebb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,27 @@ sub vcl_recv {
# #
# Typically you clean up the request here, removing cookies you don't need, # Typically you clean up the request here, removing cookies you don't need,
# rewriting the request, etc. # 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 { sub vcl_backend_response {