Google Chrome sending If-Modified-Since header inappropriately

Running Chrome v 17.0.963.83

Having an issue with logging out of a WordPress site that only happens in Chrome and I think I’ve tracked down to the HTTP headers.

Read More

Workflow: you’re logged in. Visit the homepage (aka site root, aka /) which has a log out link on it whose redirect_to sends you back to the root. You’ll notice that the response is a HTTP 200 message that has (among others) the following response:

Cache-Control:no-cache, must-revalidate, max-age=0
Date:Thu, 22 Mar 2012 20:22:53 GMT
Expires:Wed, 11 Jan 1984 05:00:00 GMT
Last-Modified:Thu, 22 Mar 2012 20:22:53 GMT

Then you log out with the link on the page. The logout script 302 redirects you to the homepage correctly. This time the request includes an If-Modified-Since header:

If-Modified-Since:Thu, 22 Mar 2012 20:22:53 GMT

This time, since you’re logged out, the cache file’s Last-Modified date is well before the dynamic page you were sent earlier, therefore the server tells you its a 304 Not Modified. Problem is, Chrome should never have asked “If-Modified-Since” because the previous response for that address was

Cache-Control:no-cache, must-revalidate, max-age=0

Does anybody know how to sidestep this behavior? Or is it a Chromium bug?

Related posts

Leave a Reply