Louis
Louis

Reputation: 221

Leverage browser caching Using S3 Amzon

I've uploaded images and set expiration headers to my S3 Amazon account. Example: http://d2aj9ttnhtlit4.cloudfront.net/mt/carrusel/elige-tu-destino.jpg When I check the images headers, it shows:

HTTP/1.1 200 OK => 
Content-Type => image/jpeg
Content-Length => 5389
Connection => close
Date => Wed, 29 Jan 2014 15:53:12 GMT
Cache-Control => max-age=2628000
Expires => Sun, 15 Feb 2015 12:00:00 GMT
Last-Modified => Wed, 29 Jan 2014 15:44:31 GMT
ETag => "16d47fedbba7aedc3e3d454baf1d6f8f"
Accept-Ranges => bytes
Server => AmazonS3
Age => 101140
X-Cache => Hit from cloudfront
Via => 1.1 a7659acb73506d9cdaa5e4d5e6f0ba0b.cloudfront.net (CloudFront)
X-Amz-Cf-Id => 1e7GVW-p4nj88gUBDzVfJnUPzyODHV2pBo1_xFTK67PIqFNuzXRriQ==

...if I run the Page speed test I get the error:

Leverage browser caching for the following cacheable resources: http://d2aj9ttnhtlit4.cloudfront.net/mt/carrusel/elige-tu-destino.jpg (expiration not specified)

For all the static images in my S3

How is that possible if expiration is set in headers?

Can you help me to understand? Thank you.

Upvotes: 3

Views: 1503

Answers (1)

sligocki
sligocki

Reputation: 6397

That image doesn't show up when I run PageSpeed Insights: https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwww.megatravel.com.mx%2F

Instead, my run says that you need to leverage browser caching for:

http://d2aj9ttnhtlit4.cloudfront.net/logo-mega-travel.png (expiration not specified) http://static.mtmedia.com.mx/mt/carrusel/elige-tu-destino.jpg (expiration not specified) http://static.mtmedia.com.mx/mt/carrusel/viajes-a-europa.jpg (expiration not specified) http://static.mtmedia.com.mx/mt/carrusel/viajes-a-medio-oriente.jpg (expiration not specified) http://static.mtmedia.com.mx/mt/carrusel/viajes-a-sudamerica.jpg (expiration not specified) http://static.mtmedia.com.mx/mt/carrusel/viajes-africa.jpg (expiration not specified) http://static.mtmedia.com.mx/mt/carrusel/viajes-al-pacifico.jpg (expiration not specified) http://static.mtmedia.com.mx/mt/carrusel/viajes-asia.jpg (expiration not specified) http://static.mtmedia.com.mx/mt/carrusel/viajes-canada.jpg (expiration not specified)

Looking at logo-mega-travel.png it looks like it has no Cache-Control headers, so that seems accurate ... but it does look like the others have valid Cache-Control headers, so it's not clear why PageSpeed is complaining about them.

Note that PageSpeed Insights online tool will cache results from testing your website for a short time, so if you just added Cache-Control headers to the other resources, it can take some time to update.

Upvotes: 2

Related Questions