0

I'm caching our generated images using the HTTP header "Cache-Control", however, when I don't cache the HTML file (comprising those img tags) using "no-cache" I see further requests sent to the server (as I add, remove, and re-add those tags). Caching the HTML file results in cached images (and no further requests).
The Only similar case I could find is this.
Any lead/link will be appreciated.

Browser: Version 32.0.1661.0 canary Aura
p.s. I very much prefer keeping the HTML file not cached.

Community
  • 1
  • 1
shex
  • 326
  • 5
  • 13
  • If you check in the web server log, is it sending an HTTP status code of 304, i.e. "Not modified"? If so, the server will not be re-sending the image. – Andrew Morton Oct 13 '13 at 17:12
  • I get Status Code:200 OK (every time) – shex Oct 13 '13 at 17:13
  • For Chrome, `200 OK` doesn't necessarily mean the request ever left the client. In many cases the response is a re-transmit of the cached version and never hits the server. The status will be `200`, which makes sense, but the status message would be `OK` (not 'cached') which drove me crazy at some point. The only distinctions I could find between these responses and actual responses were: a missing `Connection` header (which otherwise is almost always present) and a `Date` header with a value preceding the request sent. Are your requests actually hitting the server? – Ophir Radnitz Oct 13 '13 at 18:50
  • @OphirRadnitz, I used a debugger on the server :) – shex Oct 14 '13 at 09:13

1 Answers1

4

Eugene Olshenbaum answered on twitter: "close developer tools, when it is open, chrome ignores headers :))" The cache was "disabled" while the dev tools were open. Not sure why I didn't see any calls to the server if the HTML file was cached.

shex
  • 326
  • 5
  • 13
  • This. Even though "disable caching" wasn't ticked, I wasn't seeing any resources loading "from cache", and had a high TTFB. Closing the dev tools inspector then caused images to load instantly, from cache. Seems cache control headers are ignored. – i-CONICA Jan 14 '16 at 09:58