Skip to content

Commit

Permalink
Added gzip compression for content-types that can be compressed witho…
Browse files Browse the repository at this point in the history
…ut problems
  • Loading branch information
karelbemelmans committed Oct 16, 2014
1 parent 807ff4e commit 80419d1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions production.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,21 @@ sub vcl_fetch {
set beresp.do_esi = true;
}

# https://www.varnish-cache.org/docs/3.0/tutorial/compression.html
# gzip content that can be compressed
if (beresp.http.content-type == "text/plain"
|| beresp.http.content-type == "text/xml"
|| beresp.http.content-type == "text/css"
|| beresp.http.content-type == "application/x-javascript"
|| beresp.http.content-type == "application/x-font-ttf"
|| beresp.http.content-type == "application/x-font-opentype"
|| beresp.http.content-type == "application/font-woff"
|| beresp.http.content-type == "application/vnd.ms-fontobject"
|| beresp.http.content-type == "image/svg+xml"
) {
set beresp.do_gzip = true;
}

# If the request to the backend returns a code is 5xx, restart the loop
# If the number of restarts reaches the value of the parameter max_restarts,
# the request will be error'ed. max_restarts defaults to 4. This prevents
Expand Down

0 comments on commit 80419d1

Please sign in to comment.