Extend Cache - Etag

630 views
Skip to first unread message

hosting10

unread,
Feb 6, 2011, 12:30:42 PM2/6/11
to mod-pagespeed-discuss
<FilesMatch "\.(jpg|jpeg|gif|png|js|css)$">
Header unset Etag
Header set Cache-control "public, max-age=600"
</FilesMatch>

All images response by the Cache set expires to one year however set
value of the Etag: W/O
this is interpreted as value
how this can be resolved?

Joshua Marantz

unread,
Feb 6, 2011, 1:18:08 PM2/6/11
to mod-pagesp...@googlegroups.com
Hi,

Can you clarify the question?  Have you noticed a symptom that you think would result in incorrect or suboptimal behavior?

In principle, Etags are not needed with mod_pagespeed resources because the URLs have an etag-like hash embedded in them.  So if the browser has a cached value for the resource, then it must have the correct one.  However, we use the Etag "W/0" syntax to ensure that IE8 can properly cache images.

The FilesMatch stanza you gave is important for the origin resources.  However, it does not apply to resources rewritten by mod_pagespeed, because mod_pagespeed repairs the HTTP headers *after* mod_headers applies that stanza.

Hope this makes sense.
-Josh

hosting10

unread,
Feb 7, 2011, 3:36:37 AM2/7/11
to mod-pagespeed-discuss
Josh

I really dont know if this is a problem
the server send the bellow response:

HTTP/1.1 200 OK
Date: Sun, 06 Feb 2011 16:37:21 GMT
Cache-Control: max-age=31536000
Expires: Mon, 06 Feb 2012 16:36:33 GMT
Etag: W/0
Last-Modified: Sun, 06 Feb 2011 16:36:33 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 931
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/css


and the AOL tool im using is translating Etag: W/0 as there is etag
the question is why not to send Etag at all?

Joshua Marantz

unread,
Feb 7, 2011, 8:01:03 AM2/7/11
to mod-pagesp...@googlegroups.com
We have seen evidence that IE8 will not serve images from its cache when the image lacks an ETag.

The "W" in "W/0" means that this etag indicates a functional consistency, but is not guaranteeing byte-consistency.  This distinction is important because we serve different bytes for clients that do not accept gzip.

Luci

unread,
Jul 2, 2013, 5:40:15 AM7/2/13
to mod-pagesp...@googlegroups.com
Hi Josh,

Re: below; the hash-like names are OK for resources, however, the main HTML page itself may find ETags useful. The iterative optimization is still achievable when pages are cached with expiry: +1h for example - ie. over a few hours, you get a better page version.

It seems like mod_pagespeed unsets any ETag (or other cache-control headers) set by the application. Can this behavior controlled from the config?

Luci

Joshua Marantz

unread,
Jul 18, 2013, 10:04:40 AM7/18/13
to mod-pagespeed-discuss
Yes, see https://developers.google.com/speed/pagespeed/module/install#ModifyCachingHeaders

See also https://developers.google.com/speed/pagespeed/module/downstream-caching for a more sophisticated approach to caching HTML, new in the latest beta.

-Josh



--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Joshua Marantz

unread,
Jul 18, 2013, 11:35:15 AM7/18/13
to mod-pagespeed-discuss
One clarification: by using
   ModPagespeedModifyCachingHeaders off
mod_pagespeed will leave the etags on html, unless you set up downstream HTML caching, in which case etags will still be stripped.

-Josh

Lucian Kafka

unread,
Jul 18, 2013, 8:56:24 PM7/18/13
to mod-pagespeed-discuss
This is really cool Josh, thank you. I think the product is going in the right direction here.

Interestingly, I have noticed recently disparities between what mod_pagespeed outputs and what the Google Pagespeed service scores for ranking purposes. This no-caching issue was one of the things picked up - ie. output from mod_pagespeed was marked poorly by the pagespeed algorithm. Sadly there are other things as well, which makes this a peculiar situation - your pages could potentially rank lower by using mod_pagespeed...

Luci



--
You received this message because you are subscribed to a topic in the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mod-pagespeed-discuss/pxlHQ_q51UU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mod-pagespeed-di...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--

Lucian Kafka
AURA Travel holiday rentals
T: 02 8002 5402 | F: 02 8002 5401

Joshua Marantz

unread,
Jul 19, 2013, 7:29:57 AM7/19/13
to mod-pagespeed-discuss
Clarification: "PageSpeed Service" is similar to mod_pagespeed: it accelerates web-pages via the PageSpeed Optimization Libraries running as a proxy in Google's cloud.

You are talking about "PageSpeed Insights" which analyzes web pages & makes recommendations to improve speed.  There are many trade-offs that impact the speed of a web page.  Etags on HTML improves experience for end-users that come back to the same page.  But we also get value from making optimizations that preclude use of Etags on HTML, such as:
  • cache-extending short-TTL resources
  • making optimizations tuned to the specific browser
  • optimizing in the background after first view, to avoid making the first client wait for optimizations to finish
We feel that all three of these values are more important than Etags.  So while PageSpeed Insights might give us a negative score for the HTML etags, we'll get positive scores for long-cache-ttl resources & aggressively optimized images (webp).  Also, this is not reflected in the PageSpeed score, but we achieve all of this without waiting for HTML to finish optimizing before sending results to the first client to view a page, which is critical for the usability of the product.

And in the end, I've never heard of a significant overall loss of PageSpeed Insights score due to turning on mod_pagespeed.  You can of course construct that scenario due to stripping etags from an otherwise fully optimized page, but I don't think it makes sense to worry about that corner case.

-Josh
  

Lucian Kafka

unread,
Jul 19, 2013, 7:43:11 AM7/19/13
to mod-pagespeed-discuss
Well, I spent the last couple of weeks trying to increase the Pagespeed Insights score on pages. Many of the reported issues attracting low scores were from non-cacheability of resources. There were others about inlining JS, position of JS in HTML, etc.

I am a fan of mod_pagespeed, and while mod_pagespeed may provide a better user experience in the end, the irony is that it can lower the Insights score, which feeds as a signal into the SERPs...


Joshua Marantz

unread,
Jul 19, 2013, 7:56:54 AM7/19/13
to mod-pagespeed-discuss
Can you remind me of the URL to site?  What's the PageSpeed score with ?ModPagespeed=off vs on?

-Josh

Lucian Kafka

unread,
Jul 19, 2013, 8:00:29 AM7/19/13
to mod-pagespeed-discuss
It's http://www.aura.travel

Now there shouldn't be much difference... There are different cached versions being served also, so may not be the best test :)

Joshua Marantz

unread,
Jul 19, 2013, 8:12:16 AM7/19/13
to mod-pagespeed-discuss
Can you put

   ModPagespeedDomain assets.aura.travel

into your config?
-Josh

Lucian Kafka

unread,
Jul 19, 2013, 8:14:11 AM7/19/13
to mod-pagespeed-discuss
It is in the config.

Joshua Marantz

unread,
Jul 19, 2013, 8:35:41 AM7/19/13
to mod-pagespeed-discuss
It seems like those images on that domain are not being optimized.  Is that because the loopback fetch is failing?  Is there evidence in the logs or /mod_pagespeed_statistics of that?

E.g.

-Josh

Lucian Kafka

unread,
Jul 21, 2013, 4:52:37 AM7/21/13
to mod-pagespeed-discuss
Actually, you may have a point about that image...

It is because of a lazy_load scope limiting hack, possibly suggested previously by you :) (see below)... Unfortunately, this is now biting back... perhaps you can suggest an idea - I only want lazy_load for images under /thumbs, but optimization for all... how can I do that? I remember when we last tried this under VHost <directory> config, it didn't work...

### Lazyload on thumbnails
    ModPagespeedEnableFilters lazyload_images

    ModPagespeedDisallow */*.jpg*
    ModPagespeedAllow */thumbs/*.jpg*

Joshua Marantz

unread,
Jul 22, 2013, 8:12:50 AM7/22/13
to mod-pagespeed-discuss
The only way to do this is to use an img attribute to disable lazy-loading:

<img pagespeed_no_defer="" src=.../>

Joshua Marantz

unread,
Jul 22, 2013, 10:49:12 AM7/22/13
to mod-pagespeed-discuss
See also: https://code.google.com/p/modpagespeed/issues/detail?id=689.  Please feel free to add comments to that bug describing your use-case in more detail.

-Josh
Reply all
Reply to author
Forward
0 new messages