Current time: 02-17-2020, 07:44 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with browser caching using a CDN
08-21-2012, 08:00 PM
Post: #1
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"
</FilesMatch>

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!
Find all posts by this user
Quote this message in a reply
08-22-2012, 10:47 PM
Post: #2
RE: Problem with browser caching using a CDN
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.../#request1

http://www.webpagetest.org/result/120821...#request13

http://www.webpagetest.org/result/120821...#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.
Visit this user's website Find all posts by this user
Quote this message in a reply
08-23-2012, 07:08 PM
Post: #3
RE: Problem with browser caching using a CDN
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?
Find all posts by this user
Quote this message in a reply
08-27-2012, 10:24 PM
Post: #4
RE: Problem with browser caching using a CDN
Yep. Possibly with a few slight differences (particularly around the time remaining for cache) but they should essentially be identical across the board.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)