22

Until a couple of hours ago, my usual experience on SE sites has been that the homepage, individual question pages, etc., would be revalidated and reloaded whenever I navigated around with Back and Forward buttons. As I understand it, this was accomplished with maxage=0 or something very similar, and ensured that I would see the freshest content (subject to server-side caching, of course).

This all changed while I was out to dinner, and now there is no maxage=0 and the browser is caching pages indefinitely.

Steps to reproduce:

  1. Load the front page of Server Fault, Mathematics, Programmers, Super User, or any site but Stack Overflow (where I haven't yet tested).
  2. Click on a question.
  3. Wait a few minutes or even hours, so that the front page should have received new content.
  4. Click Back.

Expected results:

  • The front page reloads, showing all new questions posted since I originally clicked the question in Step 2. This is what was occurring until this evening.

Actual results:

  • The cached front page loads, showing only the questions present when I originally clicked the question in Step 2. No questions posted since that time appear. The timestamps show the wrong number of "minutes ago". On watching the Network tab, I see the browser does not attempt to revalidate the page.

More steps:

  1. Click Forward to return to the question from Step 2 above.

Expected results:

  • The question page is reloaded and any new votes, comments and answers appear.

Actual results:

  • The cached question page is loaded, and appears as it did when originally accessed. No new votes, comments or answers are visible.

This is getting to be a real pain, as it means I'm almost constantly having to hit F5 as I navigate around the site, to be sure that I'm seeing something current.

4
  • 2
    As long as I've been paying attention (over a year?), if you use the back button it's from the browser cache. Not denying the devs have changed something, but are you sure a browser setting didn't change? My work around is to get in the habit of clicking the header logo if you want refreshed results. Use the back button if you wanted the exact same cached listing again.
    – Steven V
    Aug 6, 2014 at 2:25
  • Only if it was the NSA, because my house was empty at the time....It's certainly possible something changed on my end, but it doesn't seem very likely. Aug 6, 2014 at 2:29
  • Marc Gravell tuned caching parameters yesterday. Presumably that affected more pages than intended. Aug 6, 2014 at 7:56
  • @MartijnPieters nah, same pages; just needed a minor tweak Aug 6, 2014 at 8:31

2 Answers 2

14

We made a slight tweak to the Cache-Control header for logged in users; it looks like we didn't include the max-age in this (although to be honest, what you describe is pretty much what I would expect most browser behaviour to be anyway). I will be deploying a new build including the max-age shortly.

11
  • I liked it better when max-age was 0, but I guess 60 is better than nothing. Aug 6, 2014 at 15:12
  • Chrome is behaving differently now that you altered the Cache-Control, which makes no sense. I know max-age didn't change, for example; it was 60 before, it is still 60 now. I have this idea that the Vary header was set to * before, now it is Accept-Encoding, and the Expires header is gone too. If Vary was set to * then that explains why Chrome didn't cache pages before. Did you change headers other than Cache-Control? Aug 6, 2014 at 15:33
  • Right. I had thought this was fixed, but Firefox is still not revalidating after 60 seconds. Aug 6, 2014 at 15:36
  • The correct way to handle this is for Stack Exchange to produce ETags for pages, and set Cache-Control: private, must-revalidate. The If-Modified-Since header on the request then lets you very quickly determine if a page is still fresh (e.g. the local Redis-cached ETag matches or it doesn't based on the last time the page was changed). Aug 6, 2014 at 15:41
  • @Martijn we really really don't need an etag to know whether the stackoverflow homepage has changed in a minute :) and since we display relative times, the same is true elsewhere Aug 6, 2014 at 16:11
  • 1
    Right, and since I never paid attention to wether clicking on the title gave a cached copy or fresh (I always just used reload), I'll step back from the whole 'Vary' issue too. There is a simple work-around, just use reload, done. Aug 6, 2014 at 16:13
  • Can the caching be completely disabled some places such as the reputation and responses tab? They keep highlighting the same updates over and over again.
    – Mysticial
    Aug 6, 2014 at 17:36
  • It's really annoying for max-age to be 60... Chrome cached it too much, I had to do a hard refresh to get fresh content. Also see chat.meta.stackexchange.com/transcript/message/2285529#2285529.
    – hichris123
    Aug 6, 2014 at 17:55
  • @hichris will probably change that today Aug 6, 2014 at 18:40
  • I'm pretty unhappy with the change, whatever it is. I don't like leaving a comment or voting, clicking a link, then clicking back and seeing my comment or vote has disappeared. This didn't happen before.
    – user215040
    Aug 17, 2014 at 20:48
  • Not sure what you guys did, or exactly when, but it appears to be fixed now. Sep 26, 2014 at 18:50
1

I am having this problem as well, here is my experience

When I go to my user page, I will have a blue number on reputation tab. Before, I would click it, then if I clicked back to summary tab blue number is gone. Now blue number persists until I press F5.

Before when I would ask a question, if a new answer was given I could click the question title to refresh and see the new answer. Now I can only see the new answer if I hit F5.

2
  • I will investigate Aug 6, 2014 at 17:49
  • Oh, just for those who didn't know... Pressing 'Ctrl+F5' will do a full cache clearing whilst refreshing the page... very handy to know instead of going through the browsers settings or having to install a third-party cache clearing addon/plugin. Jul 3, 2015 at 9:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .