lib/utopia/extensions/rack.rb in utopia-0.9.37 vs lib/utopia/extensions/rack.rb in utopia-0.9.38
- old
+ new
@@ -7,9 +7,11 @@
self["Cache-Control"] = "no-cache, must-revalidate"
self["Expires"] = Time.now.httpdate
end
def cache!(duration = 3600)
- self["Cache-Control"] = "public, max-age=#{duration}"
- self["Expires"] = (Time.now + duration).httpdate
+ unless (self["Cache-Control"] || "").match(/no-cache/)
+ self["Cache-Control"] = "public, max-age=#{duration}"
+ self["Expires"] = (Time.now + duration).httpdate
+ end
end
end