Forum Moderators: open
Is there a way to prevent the browser making that server request every time? I am using Apache and PHP. Could this be a Firefox-specific or YSlow-specific issue?
Here is a sample header sent by the PHP script when it serves the image:
=======
Date: Tue, 20 Jan 2009 18:17:38 GMT
Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8b mod_bwlimited/1.4 PHP/5.2.6
X-Powered-By: PHP/5.2.6
Cache-Control: max-age=86400
Pragma: cache
Expires: Tue, 20 Jan 2009 23:59:59 GMT
Last-Modified: Tue, 20 Jan 2009 00:00:01 GMT
Content-Length: 2109
Content-Type: image/jpeg
200 OK
=======
I have noticed that this server request happens with "normal" images too, and here is a sample header:
=======
Date: Tue, 20 Jan 2009 18:17:38 GMT
Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8b mod_bwlimited/1.4 PHP/5.2.6
Last-Modified: Thu, 25 Mar 2004 12:47:50 GMT
Etag: "2d73cd-4969-e06a980"
Accept-Ranges: bytes
Content-Length: 18793
Cache-Control: max-age=2592000
Expires: Thu, 19 Feb 2009 18:17:38 GMT
Content-Type: image/gif
200 OK
=======
Looking at your server headers, I suspect you'll find that all is well, and that this cache behavior is a result of the tool you're using -- In other words, either incorrect expectations while using the YSlow tool, or an invalid test case, depending on how you want to look at it...
Jim