about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <bofh@yhbt.net>2020-04-04 23:50:47 +0000
committerEric Wong <bofh@yhbt.net>2020-04-05 00:43:39 +0000
commit5df32f0b73dbec0f57192a80e3997eddfb2bf15e (patch)
treecd00f13f6b48c0ca62ebc0ab90aca2fd90e67182
parent2e8780c306078e47f24ae01bd2514198274830eb (diff)
downloadyahns-5df32f0b73dbec0f57192a80e3997eddfb2bf15e.tar.gz
Some rare clients may not support gzip.  So ensure cache layers
don't inadvertantly serve cached content to them.
-rw-r--r--extras/try_gzip_static.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/extras/try_gzip_static.rb b/extras/try_gzip_static.rb
index 4dd435a..a2dd155 100644
--- a/extras/try_gzip_static.rb
+++ b/extras/try_gzip_static.rb
@@ -79,7 +79,10 @@ class TryGzipStatic
       "Accept-Ranges" => "bytes",
     }
     h["Cache-Control"] = "no-transform" unless mime =~ %r{\Atext\/}
-    h["Content-Encoding"] = "gzip" if gz_st
+    if gz_st
+      h["Content-Encoding"] = "gzip"
+      h["Vary"] = "Accept-Encoding"
+    end
     h
   end