Content Length Mismatch

1,238 views
Skip to first unread message

Joseph Lookabaugh

unread,
Jan 19, 2015, 2:36:00 PM1/19/15
to mod-pagesp...@googlegroups.com
I have the pagespeed mod setup for apache but have been having issues with it. While trying to go through the PageSpeed broke my site; what do I do section of https://developers.google.com/speed/pagespeed/module/faq, I cam across the second issue that says, if appending ?ModPagespeed=on&ModPagespeedFilters= to a url still causes the site to break, it is an html parsing issue and to let you know.

So :) I'm letting you know. I desperately want to get this working. It's very odd, using Fiddler it always gives me a message similar to:
Content-Length mismatch: Response Header indicated 7,307 bytes, but server sent 7,308 bytes.

Sometimes it's off by a byte, sometimes it's off by hundreds of bytes.

Any thoughts on how to troubleshoot this, or what might fix it?

Many many thanks in advance!
Joe

Shawn Ligocki

unread,
Jan 20, 2015, 2:52:52 PM1/20/15
to mod-pagesp...@googlegroups.com
Can you clarify what you mean by mod_pagespeed breaking your site? Is the Content-Length mismatch the extent breakage? Or is mod_pagespeed breaking your site in a different way, but while investigating, you noticed the mismatch?

Also, could you send us your URL? That would help us debug. For example, have you tested that your site is not broken with ?ModPagespeed=off ?

Thanks for the report,
-Shawn

--
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/6620f7a5-7ced-425f-a9cc-418ec057f024%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joseph Lookabaugh

unread,
Jan 22, 2015, 11:09:58 AM1/22/15
to mod-pagesp...@googlegroups.com
So I came across a temporary solution, removing the 'content-length' setting out of the page headers fixes the issue.

The explanation of 'the site breaking' is that the content-length bytes sent in the header of the a webpage did not match the actual size in bytes as the page that was sent from the server. This was caused because the content-length header was being set before the pagespeed module was applying it's changes to the page. Therefore, it caused the actual size of the page to be larger than what the headers said, and that caused browsers to cut off the page at the length specified by the headers.

The pagespeed analyzer also did not like this, because of the discrepancy it said that the pages could not be viewed by a browser and so it could not get a score for them. 

I cannot send a url because it is in a testing environment, but I have tested with ?ModPagespeed=off, and when doing that, the content-length mismatch is no longer an issue.

Thank you for your responses, any information on setting the content-length after the pagespeed mod runs would be helpful, currently I am just not putting them in the header, which is not ideal for production.



On Tuesday, January 20, 2015 at 2:52:52 PM UTC-5, Shawn Ligocki wrote:
Can you clarify what you mean by mod_pagespeed breaking your site? Is the Content-Length mismatch the extent breakage? Or is mod_pagespeed breaking your site in a different way, but while investigating, you noticed the mismatch?

Also, could you send us your URL? That would help us debug. For example, have you tested that your site is not broken with ?ModPagespeed=off ?

Thanks for the report,
-Shawn

On Tue Jan 20 2015 at 10:09:59 AM Joseph Lookabaugh <josep...@gmail.com> wrote:
I have the pagespeed mod setup for apache but have been having issues with it. While trying to go through the PageSpeed broke my site; what do I do section of https://developers.google.com/speed/pagespeed/module/faq, I cam across the second issue that says, if appending ?ModPagespeed=on&ModPagespeedFilters= to a url still causes the site to break, it is an html parsing issue and to let you know.

So :) I'm letting you know. I desperately want to get this working. It's very odd, using Fiddler it always gives me a message similar to:
Content-Length mismatch: Response Header indicated 7,307 bytes, but server sent 7,308 bytes.

Sometimes it's off by a byte, sometimes it's off by hundreds of bytes.

Any thoughts on how to troubleshoot this, or what might fix it?

Many many thanks in advance!
Joe

--
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-discuss+unsub...@googlegroups.com.

Joshua Marantz

unread,
Jan 22, 2015, 11:55:06 AM1/22/15
to mod-pagespeed-discuss
mod_pagespeed already removes the content-length set by any upstream filters:

Where exactly were you setting content-length in your server, and based on what value?

-Josh

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/d52f846c-09d4-4c5a-bbd9-09abb79d7fcd%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages