Skip to content

Commit

Permalink
Merge pull request #18 from kbemelmans/master
Browse files Browse the repository at this point in the history
Added gzip compression
  • Loading branch information
mattiasgeniar committed Oct 20, 2014
2 parents 807ff4e + 80419d1 commit 364e50d
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 364e50d

Please sign in to comment.