Update default.vcl
add brotli compession
This commit is contained in:
parent
165a359686
commit
a8d3046ebb
21
default.vcl
21
default.vcl
@ -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 {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user