Ste*_*fan 14 disable-caching ruby-on-rails-3
我有一个饲料控制器,永远不会返回304
.
我的渲染调用看起来像这样(json_feed_content
jsonp字符串在哪里);
render :text => jsonp_feed_content, :content_type => "application/json"
Run Code Online (Sandbox Code Playgroud)
我在生产环境中将缓存设置为false:
config.action_controller.perform_caching = false
Run Code Online (Sandbox Code Playgroud)
我有一个客户端脚本,不断轮询此Feed中的内容,但大多数请求返回304
[Content Not Changed].有没有办法防止我的rails应用程序这样做?
小智 25
将其添加到您的控制器:
#update last-modified so content is always fresh
headers['Last-Modified'] = Time.now.httpdate
Run Code Online (Sandbox Code Playgroud)
可能有更好的方法,但这对我有用.
归档时间: |
|
查看次数: |
4957 次 |
最近记录: |