N7: Media (Page Info Tab) contents not cached bug?
Jean-Christian Imbeault 30 September 2002 08:33:33
When using the View|Page Info Menu item I get a nice tabbed window showing information for the page I just loaded. Clicking the Media tab shows what contents the page needed and importantly whether the contents are cached or not.
If I load .php pages I am developing off a local server (http://192.168... not accessible from the internet) I see that in the Media tab the "Source" for the gif/jpeg's on my page is listed as "(not cached)" ... but if I look in the cache folder the files are there ...
I only see this problem with my local .php pages. I do not have the problem with IE. I do not see this problem if I access .php files on the public Internet.
Does N7 have a problem caching files from private (192.168...) networks?
Or is N7 really caching the files and there is a problem with the Media (Page Info Tab) in that is incorrectly stating that media has not been cached when it has?
Is this a setting in PHP, N7, or Apache I need to change?
This is really worrying me so any comments appreciated!
Chris Shiflett 30 September 2002 09:00:03 [ permanent link ]
I do not know the answer to your question for certain, but perhaps it has to do with the Cache-Control HTTP header. This header has a directive called "no-cache" which allows caching but requires that the cached copy be revalidated each time.
To test this, try changing the image source (on your server) and request the page again. If Netscape fetches the fresh resource, this might be it. If you see the same image as before, then there is definitely a problem somewhere.
Sometimes caches are used in this way to cut down on traffic without avoiding interaction with the origin server. Basically, the origin servers gets final say so to speak as to whether the cached copy is still valid, rather than the cache deciding on its own. This is extremely common in practice.
Maybe that provides a possible explanation.
Chris
Jean-Christian Imbeault wrote:
When using the View|Page Info Menu item I get a nice tabbed window > showing information for the page I just loaded. Clicking the Media tab > shows what contents the page needed and importantly whether the > contents are cached or not.>
If I load .php pages I am developing off a local server > (http://192.168... not accessible from the internet) I see that in the > Media tab the "Source" for the gif/jpeg's on my page is listed as > "(not cached)" ... but if I look in the cache folder the files are > there ...>
I only see this problem with my local .php pages. I do not have the > problem with IE. I do not see this problem if I access .php files on > the public Internet.>
Does N7 have a problem caching files from private (192.168...) networks?>
Or is N7 really caching the files and there is a problem with the > Media (Page Info Tab) in that is incorrectly stating that media has > not been cached when it has?>
Is this a setting in PHP, N7, or Apache I need to change?
Jean-Christian Imbeault 30 September 2002 09:20:54 [ permanent link ]
Chris Shiflett wrote:>
To test this, try changing the image source (on your server) and request > the page again. If Netscape fetches the fresh resource, this might be > it. If you see the same image as before, then there is definitely a > problem somewhere.
I did as you suggested and hit the refresh button on N7. The .gif did *not* display. I guess that is the proper behaviour?
The php page was not changed, just the gif.
I know the browser probably checked with the server to see if the php page was still valid (and found it was), but do browsers normally check to see if the images in the HTML are still valid too?
Either way that does not answer my question as to wether the image had been cached in the first place. All I know is that the browser did not use a cached copy of the image (possibly because the server told it the gif was no longer available).
How can I test that the image *was* cached, *and* that the cached copy is used when it the server's version has no been changed?
Chris Shiflett 30 September 2002 09:33:09 [ permanent link ]
Jean-Christian Imbeault wrote:
I did as you suggested and hit the refresh button on N7. The .gif did > *not* display. I guess that is the proper behaviour?
Hmmm. Only if the image referenced in the HTML did not exist. It should have simply fetched the fresh resource (image).
I know the browser probably checked with the server to see if the php > page was still valid (and found it was), but do browsers normally > check to see if the images in the HTML are still valid too?
When a browser discovers an image tag in the HTML document, it issues a separate request for the image. It is exactly the same as if you had typed in the URL to the image in your browser's location bar. As far as caching is concerned, the type of content (text, html, image, etc.) does not affect caching. There are specific headers that do that.
Either way that does not answer my question as to wether the image had > been cached in the first place. All I know is that the browser did not > use a cached copy of the image (possibly because the server told it > the gif was no longer available).>
How can I test that the image *was* cached, *and* that the cached copy > is used when it the server's version has no been changed?
The only way to be certain would be to view the HTTP communication between your browser and the Web server. Do you have a way to do this? My guess is that the browser will issue a request for the image anyway, but the server's response is a 304 Not Modified or whatever.
This is the one I'm talking about. The "no-store" directive is the one > ignored by IE. Is this the HTTP response generated after you added the > header("Cache-Control: no-cache") in your code?
No, I have no changed my PHP code yet. I was hoping I could set this in Apache since it is basically a setting I want on all my pages.
Cache-Control: no-cache>
If you are unable to change this, it is definitely something that needs > to be fixed in PHP.
I'll change my code now and see what the header becomes.
Just to make sure header("Cache-Control: no-cache") will cause the browser to cache the content?
This is the one I'm talking about. The "no-store" directive is the one ignored by IE. Is this the HTTP response generated after you added the header("Cache-Control: no-cache") in your code? I was thinking it would override this header to make it simply:
Cache-Control: no-cache
If you are unable to change this, it is definitely something that needs to be fixed in PHP.
If you would like to report an abuse of our service, such as a spam message, please . Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .