Nei*_*eil 20 ruby heroku varnish sinatra http-headers
我有一个基于Ruby和Sinatra的工作应用程序部署在Heroku上.
我想利用Heroku上可用的HTTP缓存,它使用Varnish.
我不确定设置标头的最佳方法是什么,以及正确的语法.
有关最佳方法和语法的任何想法?
before do
headers "Content-Type" => "text/html; charset=utf8"
end
get '/' do
headers['Cache-Control'] = 'public, max-age=600'
# SOME STUFF HERE
haml :home, {:layout => :layout_minfooter}
end
Run Code Online (Sandbox Code Playgroud)
the*_*Man 30
通常动态生成的页面没有缓存所以
response.headers['Cache-Control'] = 'public, max-age=300'
Run Code Online (Sandbox Code Playgroud)
标题是正确的起点.
尝试使用" 使用基于Web的服务 "中的某项服务查看它们是否显示在从您的站点发回的HTTPd标头中.