Cache-Control:expires_in不会更改标头

时间:2013-08-13 19:08:51

标签: ruby-on-rails cache-control

我在Nginx上运行了一个Rails 3.2应用程序。

我需要为我的应用程序的其中一个页面设置自定义Cache-Control标头。

我正在使用expires_in - http://apidock.com/rails/ActionController/Base/expires_in

def my_action
  expires_in 3600

但是,当我在开发中打开页面时,标题是:

Cache-Control:must-revalidate, private, max-age=0

我没有在应用中的任何其他位置重置标头。为什么不起作用?

2 个答案:

答案 0 :(得分:0)

试试这个:

expires_in 2.hours, :public => true

答案 1 :(得分:0)

您可以尝试gem rails-cache_control。它会自动添加Cache-Control标头。