Note that there are some explanatory texts on larger screens.

plurals
  1. POHeroku & Rails - Varnish HTTP Cache Not Working
    primarykey
    data
    text
    <p>My heroku website's root page is essentially static, it has some ruby code in the view when its generated, but there's nothing specific to a single user, so I'd like to have it cached by Varnish and served up without hitting my dyno (note that there are other pages that are dynamic in the application).</p> <p>Heroku makes it seem very simple <a href="http://devcenter.heroku.com/articles/http-caching" rel="nofollow">here</a>. Just add <code>response.headers['Cache-Control'] = 'public, max-age=300'</code> and it'll cache for 5 minutes before regenerating.</p> <p>To test this I made the changed and outputted the date (<code>Time.now</code>) to the page, to see if it would remain the same for 5 minutes, but every time I access the page on a new browser it updates. Refreshing on the same browser works fine, but I think that's because of the browser caching, not Heroku.</p> <p>If it's any help, when I do a curl -i to get the HTTP headers, I get this:</p> <pre><code>HTTP/1.1 200 OK^M Server: nginx/0.7.67^M Date: Thu, 29 Dec 2011 02:03:33 GMT^M Content-Type: text/html; charset=utf-8^M Connection: keep-alive^M Cache-Control: public, max-age=300^M X-Ua-Compatible: IE=Edge^M Etag: "8a1b58f048968803980417a2914764d0"^M X-Runtime: 0.038393^M Content-Length: 8310^M X-Varnish: 1040651825^M Age: 0^M Via: 1.1 varnish^M </code></pre> <p>Basically, I'd like to make sure that it's generated once and then cached in Varnish, am I missing any options, do I have to configure something more? If you have other suggestions for serving a fast static page I'd love those as well.</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload