Site vs File (Browser Caching) Different? Why?
|
10-04-2013, 04:32 AM
Post: #1
|
|||
|
|||
Site vs File (Browser Caching) Different? Why?
Hey All,
I am new to the forum here. I have a question about why when I test the main site domain forum.bonusfeber.no; I get failures on Browser Cached images. But if you try the images directly (@either cdn. OR forum.) they will pass with flying colors? Leverage browser caching of static assets: 50/100 FAILED - (No max-age or expires) - http://cdn.bonusfeber.no/styles/default/...isemal.png FAILED - (No max-age or expires) - http://cdn.bonusfeber.no/styles/default/...sebrev.png FAILED - (No max-age or expires) - http://cdn.bonusfeber.no/styles/default/...rammer.png FAILED - (No max-age or expires) - http://cdn.bonusfeber.no/styles/default/...rammer.png Thanks, -Bill |
|||
10-07-2013, 07:26 PM
Post: #2
|
|||
|
|||
RE: Site vs File (Browser Caching) Different? Why?
Quote:But if you try the images directly (@either cdn. OR forum.) they will pass with flying colors They don't, actually. Compare these results: http://www.webpagetest.org/result/131007...1/details/ http://www.webpagetest.org/result/131007...1/details/ Both show that navigation-tab.png has no expiry headers. Some other images do, however. My guess is that you set up caching headers for these images after CloudFront first fetched them from your server. Not just the images, but also the headers are cached by the CDN at the initial pull request. To update the header contents, you'll need to purge these resources from CloudFront's edge servers. You can do this fairly easily from the AWS panel. If you're pushing your resources manually to CloudFront, rather than having them pulled from your server at the first request, you'll have to manually correct the headers (in S3 or wherever you store them). |
|||
10-08-2013, 01:45 AM
(This post was last modified: 10-08-2013 02:59 AM by qops1981.)
Post: #3
|
|||
|
|||
RE: Site vs File (Browser Caching) Different? Why?
(10-07-2013 07:26 PM)robzilla Wrote:Quote:But if you try the images directly (@either cdn. OR forum.) they will pass with flying colors Hey Robzilla, Yah.. I tried a couple invalidations, but they still don't seem to come through. Here is a curl -I result from one of the images: curl -I http://cdn.bonusfeber.no/styles/default/...lounge.png HTTP/1.1 200 OK Content-Type: image/png Content-Length: 3102 Connection: keep-alive Accept-Ranges: bytes Cache-Control: max-age=2678400 Cache-Control: public, must-revalidate, proxy-revalidate Date: Mon, 07 Oct 2013 08:54:56 GMT ETag: "523ca680-c1e" Expires: Thu, 07 Nov 2013 08:54:56 GMT Last-Modified: Fri, 20 Sep 2013 19:48:16 GMT Pragma: public Server: nginx Age: 24341 Via: 1.0 xxxxx.cloudfront.net (CloudFront) X-Cache: Hit from cloudfront X-Amz-Cf-Id: xxxxxxxx AND here is the NGINX Config for that directory: location ~ ^/(styles|css|js|cometchat|3p_content|data/attachments)/.*\.(jpg|jpeg|gif|png|css|js|ico|xml|swf)$ { access_log off; log_not_found off; expires 31d; add_header Pragma public; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; } Is there anything missing from this header? I see a Max-Age so I don't know why WPT says that there isn't. Thanks, -Bill |
|||
10-08-2013, 05:22 AM
(This post was last modified: 10-08-2013 05:29 AM by robzilla.)
Post: #4
|
|||
|
|||
RE: Site vs File (Browser Caching) Different? Why?
Do you have a link to your WPT test results? The expiry headers are visible here:
http://www.webpagetest.org/result/131007...1/details/ The results for your forum page show there are some PNGs without expiry headers: http://www.webpagetest.org/result/131007...ic_content When I fetch these images manually, I don't get the expiry headers either, but that's probably because they need to be purged first. Since you're redirecting forum.* to cdn.*, I can't check the exact headers nginx sends for these images. |
|||
10-08-2013, 06:17 AM
Post: #5
|
|||
|
|||
RE: Site vs File (Browser Caching) Different? Why?
Hey robzilla,
I did an "invalidation" on styles/ styles from the AWS console, hours before I tested. cdn.* points to the CDN who's origin is stat.* I curl -I tested the with with stat.* and while it shows in a slightly different order; it was all there: curl -I http://stat.bonusfeber.no/styles/default...lounge.png HTTP/1.1 200 OK Accept-Ranges: bytes Cache-Control: max-age=2678400 Cache-Control: public, must-revalidate, proxy-revalidate Content-length: 3102 Content-Type: image/png Date: Mon, 07 Oct 2013 20:11:55 GMT ETag: "523ca680-c1e" Expires: Thu, 07 Nov 2013 20:11:55 GMT Last-Modified: Fri, 20 Sep 2013 19:48:16 GMT Pragma: public Server: nginx Connection: keep-alive |
|||
10-08-2013, 06:49 AM
(This post was last modified: 10-08-2013 06:49 AM by robzilla.)
Post: #6
|
|||
|
|||
RE: Site vs File (Browser Caching) Different? Why?
The CDN reports an Age header with a value of 547175 for this image: http://cdn.bonusfeber.no/styles/default/...lounge.png
Unless I'm mistaken, 547175 is approximately one week. Did you invalidate styles/* a week ago? Also, note that there are no expiry headers for images within the 3p_content folder, such as http://stat.bonusfeber.no/3p_content/img...r_logo.png |
|||
10-08-2013, 08:30 AM
Post: #7
|
|||
|
|||
RE: Site vs File (Browser Caching) Different? Why?
(10-08-2013 06:49 AM)robzilla Wrote: The CDN reports an Age header with a value of 547175 for this image: http://cdn.bonusfeber.no/styles/default/...lounge.png Hey robzilla, Yah, I ran the invalidation before, not even an hour had past. I just tried another invalidation with: styles/* styles/ styles 3p_content/* 3p_content/ 3p_content And it is still showing.. I am guessing this might be an issue on the AWS side then, with the invalidations not working. However, I am still confused why it does show on the CURL but WPT still says there is no max-age. -Bil |
|||
10-08-2013, 07:43 PM
(This post was last modified: 10-08-2013 07:43 PM by robzilla.)
Post: #8
|
|||
|
|||
RE: Site vs File (Browser Caching) Different? Why?
Yeah, the age is now 593784 so apparently these files aren't purged properly.
As for your images within 3p_content showing no cache headers (on stat.*), that's probably a problem in your nginx configuration. Quote:However, I am still confused why it does show on the CURL but WPT still says there is no max-age. Since it's a CDN, you may be hitting a different edge server locally than WPT is from its test location. |
|||
10-09-2013, 02:41 AM
Post: #9
|
|||
|
|||
RE: Site vs File (Browser Caching) Different? Why?
(10-08-2013 07:43 PM)robzilla Wrote: Yeah, the age is now 593784 so apparently these files aren't purged properly. Hey robzilla, I got it all figured out. Thanks! I individually invalidated the files that were listed on the WPT page and the 3p_content; There was a previous directive in the NGINX config that was overriding the config I showed you. All fixed now :-) Thanks again, -Bill |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)