Mod Pagespeed stripping last-modified headers

361 views
Skip to first unread message

Les Fenison

unread,
Nov 9, 2015, 4:19:32 PM11/9/15
to mod-pagespeed-discuss
I have read that the issue of pagespeed stripping last-modiied headers was supose to have been fixed in issue 652 however, it is still doing it.  Is there a setting that I need to change to make it pass these headers?

I am running mod-pagespeed-stable-1.9.32.10-7443.x86_64

My header with pagespeed off looks like this...

HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Cache-Control: max-age=43200, public, must-revalidate
Connection: Keep-Alive
Content-Encoding: gzip
Content-Length: 2237
Content-Type: text/html
Date: Mon, 09 Nov 2015 21:17:17 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive: timeout=5, max=250
Last-Modified: Sat, 07 Nov 2015 04:51:10 GMT
Pragma: no-cache
Server: Apache
Vary: Accept-Encoding

But with pagespeed on, it looks like this...

HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Cache-Control: max-age=0, no-cache, must-revalidate
Connection: Keep-Alive
Content-Encoding: gzip
Content-Length: 20861
Content-Type: text/html; charset=utf-8
Date: Mon, 09 Nov 2015 21:18:17 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive: timeout=5, max=250
Pragma: no-cache
Server: Apache
Vary: Accept-Encoding
X-Mod-Pagespeed: 1.9.32.10-7443


Maksim Orlovich

unread,
Nov 10, 2015, 11:10:22 AM11/10/15
to mod-pagesp...@googlegroups.com
Just to make sure, you are using ModPagespeedModifyCachingHeaders off, right?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/be088798-2a3c-4378-b925-c315dd002ca9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jeff Kaufman

unread,
Nov 10, 2015, 11:24:07 AM11/10/15
to mod-pagespeed-discuss
Your initial headers are pretty strange. How do you expect "no-store,
no-cache, must-revalidate" to combine with "max-age=43200"?
> https://groups.google.com/d/msgid/mod-pagespeed-discuss/CAHRWggRjwR%2Bq8vRdXzr98wQdh-6kCMAet3tnUL3FVjG6ESdKJA%40mail.gmail.com.

Joshua Marantz

unread,
Nov 10, 2015, 11:34:27 AM11/10/15
to mod-pagespeed-discuss

I want to jump in and point out that mod_pagespeed usually does modify the content and so it makes sense to reset that header.  Unfortunately mps must commit to that header before it knows whether it actually modified the content.  What is the implication of that header for you?

Josh

Les Fenison

unread,
Nov 10, 2015, 5:17:58 PM11/10/15
to mod-pagespeed-discuss
Actually I didn't specify ModPagespeedModifyCachingHeaders at all, but I just added it = off and now the last-modified is coming thru just fine.   Thanks.

Les Fenison

unread,
Nov 10, 2015, 5:24:00 PM11/10/15
to mod-pagespeed-discuss
I fixed the last-modified issue by adding ModPagespeedModifyCachingHeaders = off, but do I need to make changes to max-age, no-cache and/or must-revalidate too?

I have been running those settings for a long time and never knew..   

Joshua Marantz

unread,
Nov 10, 2015, 6:04:57 PM11/10/15
to mod-pagespeed-discuss
Please see the warning in https://developers.google.com/speed/pagespeed/module/install#ModifyCachingHeaders -- there's a reason that defaults to 'on'.

-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.

Les Fenison

unread,
Nov 10, 2015, 6:21:29 PM11/10/15
to mod-pagespeed-discuss
Ok, now I am even more confused..  I am new at this and not understanding what I am doing wrong at all. But I did read that warning.   the modifycachingheaders=off did fix the problem with the last-modified but apparently it creates other problems. Is there a better way to keep the last-modified working?

Also, you mentioned that the max-age, no-cache, and must-revalidate was strange.  What do you recommend?

Joshua Marantz

unread,
Nov 10, 2015, 6:33:48 PM11/10/15
to mod-pagespeed-discuss
Why do you think it's a problem that PageSpeed adjusts LastModified?  It does modify the page.


--
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.

Les Fenison

unread,
Nov 10, 2015, 6:51:04 PM11/10/15
to mod-pagespeed-discuss
Correct me if I am wrong but I thought last-modified was needed for search engines to know when a page has changed as well as browsers so they don't keep loading the same old content over and over.    Likewise, I have a sitemap builder that puts the last-modified in to the sitemap.xml based on the last-modified it gets from the page.    It just seems all these things won't work correctly if they can't detect when it was last modified.    Isn't this important?

Joshua Marantz

unread,
Nov 10, 2015, 8:26:38 PM11/10/15
to mod-pagespeed-discuss
I can't remember why we don't include a last-modified header, but if we did it would in general always be equal to Date.  It would be incorrect to leave the last-modified header unmodified, because PageSpeed does modify the page.

Do you have a reference indicating what the downside of omitting last-modified is?

Note that many top sites use PageSpeed and have not reported SEO or other problems related to last-modified.  E.g. see http://trends.builtwith.com/Server/mod_pagespeed

-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.

Jeff Kaufman

unread,
Nov 11, 2015, 6:19:29 AM11/11/15
to mod-pagespeed-discuss
The main thing crawlers use a Last-Modified header for is
If-Modified-Since requests, to reduce bytes. PageSpeed doesn't
support that kind of request on html pages, and if we did we would
handle it by setting an ETag.

Another use of Last-Modified is for clients to guess at an expiration
time when one isn't specified. [1] But we're specifying an expiration
of "immediately" so that doesn't apply here.

I believe crawlers used to use Last-Modified to figure out how often
to crawl, but I believe modern crawlers don't do that anymore and look
at lots of other signals like whether the site is actually changing.
I don't know anything in particular about how Googlebot works though.
If this was something important then there would be blog posts by
Google telling people to be careful how they set their Last-Modified
headers and explaining how they'd be interpreted.

[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.2.2
> https://groups.google.com/d/msgid/mod-pagespeed-discuss/CAGKR%2BEBw%2BcNrA%2BF1rkE8W72zHVttc3xx3Gk%3DwgTATR6DxTuMmg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages