[ACCEPTED]-How do I set HTTP Headers in Ruby/Sinatra app, hosted on Heroku?-varnish
Accepted answer
Usually dynamically generated pages have 4 no caching so the
response.headers['Cache-Control'] = 'public, max-age=300'
header is the right starting 3 point.
Try using one of the services at 2 "Use a Web-based service" to see if they show up in the 1 HTTPd header sent back from your site.
You can also access the header fields of 1 the response object with this syntax:
response['Cache-Control'] = 'public, max-age=600'
In Sinatra you can use the cache_control
method:
get '/' do
# Cache for 24 hours
cache_control :public, max_age: 86400
# Your magic goes here
end
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.