Why is a page cached even after sending headers without a cache?

I did a lot of research on this issue and asked many people for help and still have not succeeded. Here are the details ...

I am involved in the development of a website that extracts data from various data files, combines them into a temp.csv file and then graphically using the popular charting library: dygraphs. The main part of the website is written in PHP. The parameters that define the graphic data are stored in the user session, the CSV is named after the user session and is available for download, and then. The CSV file is written to a script that passes it to the dygraphs object, and we found even with no-cache headers sent:

header("Cache-Control: no-cache, must-revalidate"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); 

Many users collide in the middle of the session (when generating quite different graphs) on the page displaying the old static page rendering (the data that they drew earlier in the session), as if they were cached and loaded instead of receiving a new request. It only gets weirder:

I checked using the developer tools in both Firefox and Chrome, and both browsers get headers very well without a cache; Even if the problem occurs, if you are viewing the source of the page, the source is the correct content (the table / legend is also dynamically created using php, the source shows the correct table, but what is displayed is older content); the page starts to render correctly until the graph is displayed, and then displays the older content; older content is displayed as if it were a completely static overlay - the cached graph does not have the same dynamic functions (flipping through the display of data points, scaling and panning, etc.) And it is as if the correct page was somewhere below it (the download button for the csv file moves depending on how big the table is. The old static page does nothing if you press the .csv download button, but if you can find it on the page below it, you can click and all even load CSV. The data in the correct CSV)

This is one of the strangest things I've seen in development so far. Some other important facts are that all the problems that I personally encountered occurred while using Chrome. These symptoms have been reported by Firefox users. IE users had the same problems (IE users are forced to use a chrome frame).

I'm on my way now. We sent php headers; we tried to configure the cache profile for php on IIS as "DisableCache" (or something else); we tried to send a random query string to the results page; we tried all the relevant meta tags - all without success.

+4
source share
2 answers

As long as your server ignores the URL parameters, you can bypass any browser caching by extracting "url.csv? (Random number)" instead of "url.csv".

0
source

Have you tried "Last-Modified" and "ETag"? and just look at the HTTP header about this graph.

0
source

All Articles