From 5df32f0b73dbec0f57192a80e3997eddfb2bf15e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 4 Apr 2020 23:50:47 +0000 Subject: extras/try_gzip_static: set "Vary: Accept-Encoding" on gzip Some rare clients may not support gzip. So ensure cache layers don't inadvertantly serve cached content to them. --- extras/try_gzip_static.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-24-ge0c7