Problem with browser caching using a CDN

I’ve run several tests since switching some images over to a CDN and I’m seeing differing results each time in the “Leverage browser caching of static assets” and “Use a CDN for all static assets” sections of the report.

This is the most recent test of one of our pages where the product images and some of the template images use a CDN:
http://www.webpagetest.org/result/120821_KW_6HN/

This is a previous test for the same page (no changes were made between tests):
http://www.webpagetest.org/result/120821_55_6GB/

The htaccess file in the images directory on both the main domain and the CDN domain contains this code:
<FilesMatch “.(jpg|jpeg|png|gif|swf)$”>
Header set Cache-Control “max-age=604800, public”

I’ve tested individual images served from the CDN repeatedly on different machines and, initially, I get A’s across the board, then on re-test I get an F for browser caching. I ran this test on one of the CDN images just before posting here which shows an F for browser caching.
http://www.webpagetest.org/result/120821_RQ_7QW/

But when I check the same image on Redbot, it shows Cache Control in the headers.

When I test any images on the main domain (where browser caching has been in place for years) the results consistently show cache control is working.

The main domain and CDN domain are both on the same dedicated server.

Yslow and PageSpeed on Firefox also show inconsistent results for the CDN images.

I don’t know if this inconsistency is a problem with the CDN set up, something to do with local caching or an issue with webpagetest. Any help would be appreciated!

If I had to guess I would say the the CDN itself is behaving very inconsistently across the different edge nodes. Here is the same image across all 3 tests:

http://www.webpagetest.org/result/120821_RQ_7QW/1/details/#request1

http://www.webpagetest.org/result/120821_55_6GB/1/details/#request13

http://www.webpagetest.org/result/120821_KW_6HN/1/details/#request13

They are served by 3 different IP addresses and the response headers are radically different. I’d reach out to the CDN provider and ask them WTF.

Thanks for that.

So, when using a CDN, you would expect to see the same response headers regardless of which IP/Server in the CDN actually serves the image. Is that right?

Yep. Possibly with a few slight differences (particularly around the time remaining for cache) but they should essentially be identical across the board.