Are HTTP Expires and Cache-Control headers honored?

Ken17 Nov 2011 10:41 AM
I have a series of icons (weather icons) which may all be the same (like, all day will be sunny).

If I set all of the images' srcs to the same URL (pointing to a server-based file), it appears I am seeing a separate request for each image get to the server, even though they are the same file, and the Expires and Cache-Control identifies these as "good" for a day.

Cache-Control: max-age=86400
Expires: Fri, 18 Nov 2011 13:48:47 GMT

This makes it appear that the framework is not acting as expected concerning HTTP Expires and Cache-Control headers.

Any ideas?
Ken17 Nov 2011 2:26 PM
That may describes a problem where he framework simply doesn&#39;t understand a same-request is pending. Perhaps a better example of bad or no caching is seeing this in our server logs... note that you&#39;ll see same-second requests and one that&#39;s five minutes apart.:<br><br><div>97.120.233.92 - - [16/Nov/2011:21:22:43 -0600] &quot;GET<div>/yahoo-tv-widget/snippetWxIcons/960x540/017.png HTTP/1.1&quot; 200 7779 191us &quot;-&quot;<div>&quot;Mozilla/5.0 (Toshiba; U; Linux; en-US) Konfabulator/5.5.23&quot;<div>97.120.233.92 - - [16/Nov/2011:21:22:43 -0600] &quot;GET<div>/yahoo-tv-widget/snippetWxIcons/960x540/017.png HTTP/1.1&quot; 200 7779 214us &quot;-&quot;<div>&quot;Mozilla/5.0 (Toshiba; U; Linux; en-US) Konfabulator/5.5.23&quot;<div>70.181.144.116 - - [16/Nov/2011:22:19:09 -0600] &quot;GET<div>/yahoo-tv-widget/snippetWxIcons/960x540/013.png HTTP/1.1&quot; 200 8561 314us &quot;-&quot;<div>&quot;Mozilla/5.0 (Toshiba; U; Linux; en-US) Konfabulator/5.5.23&quot;<div>70.181.144.116 - - [16/Nov/2011:22:19:09 -0600] &quot;GET<div>/yahoo-tv-widget/snippetWxIcons/960x540/013.png HTTP/1.1&quot; 200 8561 167us &quot;-&quot;<div>&quot;Mozilla/5.0 (Toshiba; U; Linux; en-US) Konfabulator/5.5.23&quot;<div>71.221.160.121 - - [16/Nov/2011:22:38:23 -0600] &quot;GET<div>/yahoo-tv-widget/snippetWxIcons/960x540/110.png HTTP/1.1&quot; 200 8534 231us &quot;-&quot;<div>&quot;Mozilla/5.0 (Toshiba; U; Linux; en-US) Konfabulator/5.5.23&quot;<div>71.221.160.121 - - [16/Nov/2011:22:43:05 -0600] &quot;GET<div>/yahoo-tv-widget/snippetWxIcons/960x540/110.png HTTP/1.1&quot; 200 8534 183us &quot;-&quot;<div>&quot;Mozilla/5.0 (Toshiba; U; Linux; en-US) Konfabulator/5.5.23&quot;<br><br><br><div class="quote "><div class="quotetop ">QUOTE<cite>(Ken @ 17 Nov 2011 10:41 AM)</cite><blockquote class="quotemain">I have a series of icons (weather icons) which may all be the same (like, all day will be sunny).<br><br>If I set all of the images&#39; srcs to the same URL (pointing to a server-based file), it appears I am seeing a separate request for each image get to the server, even though they are the same file, and the Expires and Cache-Control identifies these as &quot;good&quot; for a day.<br><br><div>Cache-Control: max-age=86400<div>Expires: Fri, 18 Nov 2011 13:48:47 GMT<br><br>This makes it appear that the framework is not acting as expected concerning&nbsp;HTTP Expires and Cache-Control headers.<br><br>Any ideas?</div></div></blockquote></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
Vivek Jani18 Nov 2011 4:00 AM
Unless you have images as data, it is recommended to include them in the widget itself. There is an image cache but is not dependent on the Cache-control headers. You need to appreciate that this is an embedded environment and not all TV models have disk/memory resources like a PC browser has. So, I suggest if the images are supposed to be static and are few in number, then it is just better to keep them locally with the widget.<br><br>Thanks,<br>Vivek
Ken18 Nov 2011 9:59 AM
Thanks for the reply,&nbsp;Vivek.<br><br>I totally understand there must be limitations in that environment.<br><br>It&#39;s tricky for us as there are quite a number of weather conditions, and sometimes they are doubled for day and night versions. They are static, but there&#39;s a few of them. Very early on we were discouraged from including them in the widget, but it seems like we probably should; for the&nbsp;<span style="color:#333333;line-height:16px;">960x540 set of icons, we&#39;re only talking about 3 Megs.</span>
Vivek Jani21 Nov 2011 1:13 AM
3MB is definitely on the higher side, since total unzipped widget size is limited to 2MB. In this case, you must only fetch images via the URLs.<br><br>Thanks,<br>Vivek