Page Speed Not Working on HTTPS

141 views
Skip to first unread message

Gabriel Kuperman

unread,
Aug 31, 2014, 9:59:08 AM8/31/14
to mod-pagesp...@googlegroups.com
Hello,

We recently installed mod_pagespeed on our Apache server. The installation appears to be successful. However none of the Page Speed tests have revealed any improvements to Page Speed on the domain: https://www.webstarmultimedia.com

We added these filters to the site's ,htaccess file:

ModPageSpeed on
ModPagespeedRewriteLevel CoreFilters
ModPagespeedEnableFilters prioritize_critical_css
ModPagespeedEnableFilters defer_javascript
ModPagespeedEnableFilters sprite_images
ModPagespeedEnableFilters convert_png_to_jpeg
ModPagespeedEnableFilters convert_jpeg_to_webp
ModPagespeedEnableFilters collapse_whitespace
ModPagespeedEnableFilters remove_comments
ModPagespeedEnableFilters combine_css

Thank you in advance for your help.

Joshua Marantz

unread,
Sep 2, 2014, 10:05:49 AM9/2/14
to mod-pagespeed-discuss
I don't think the configuration is fully working, because if I add ?PageSpeedFilters=+collapse_whitespace it shrinks your page, and your htaccess file has that enabled already.  I think there is some interaction with W3 Total Cache, but it's not obvious from my end what it is.

Here's what I observed:

If I just view->source on 'https://www.webstarmultimedia.com/', whitespace is not collapsed.  This is a pretty basic function of MPS when you enable it, which you did, and it pretty much never fails.  Yet on your site I see this:

<!DOCTYPE html>
        <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="https://www.webstarmultimedia.com/wp-content/cache/minify/000000/dab49/default.include.a46269.css" media="all" />
        <title>Digital Marketing Agency in Toronto | WebStar Multimedia</title>

That can't happen :)

When I add any PageSpeed query param, e.g. ?PageSpeedFilters=+debug, then collapse_whitespace works fine:

<!DOCTYPE html>
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="https://www.webstarmultimedia.com/wp-content/cache/minify/000000/dab49/default.include.a46269.css" media="all"/>
<title>Digital Marketing Agency in Toronto | WebStar Multimedia</title>

I suspect that W3 Total Cache is caching your unoptimized HTML, so the PageSpeed query-params acts as a cache-buster and we can make changes to the HTML. However, I am not seeing any of your URLs get renamed to ".pagespeed." variants, so we can't extend your short cache lifetime or optimize your images, so there might be something else going wrong with the loopback fetches PageSpeed needs to make to read the files.

From using "wget" on your site, I suspect that there's some kind of user-agent filtering going on.  E.g. if I try to fetch your CSS file like this, it fails:


Connecting to www.webstarmultimedia.com (www.webstarmultimedia.com)|69.65.38.199|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2014-09-02 09:59:24 ERROR 404: Not Found.

But if I add a chrome user-agent it works:

% wget https://www.webstarmultimedia.com/wp-content/themes/webstar/style.css --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36" 
Connecting to www.webstarmultimedia.com (www.webstarmultimedia.com)|69.65.38.199|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 41366 (40K) [text/css]
Saving to: `style.css'

100%[======================================>] 41,366      --.-K/s   in 0.05s   


When mod_pagespeed tries to fetch resources so they can be optimized, it uses its own user-agent that includes mod_pagespeed version number and the version of the Serf http library we are using.  I noticed too that your resources specify "Vary:User-Agent'.  If they really do Vary by user agent, then mod_pagespeed will have a hard time caching and optimizing them.  It is much better, if you need to send different css, js, and image files to different UAs, to use different URLs for those and make the HTML vary on UA, rather than the resources.

In other words, don't have UA sensitivity in your resource serving path.  I'm not sure if that's something that W3 Total Cache does now...I never heard of it doing that before.

-Josh

2014-09-02 09:59:33 (743 KB/s) - `style.css' saved [41366/41366]

--
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/ee52e1de-0f8d-4bba-bad0-1264abf8803a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gabriel Kuperman

unread,
Jan 31, 2015, 8:11:20 AM1/31/15
to mod-pagesp...@googlegroups.com
Hi Josh,

I'm embarrassed how long it's taken me to reply.  I didn't see this response till now, as I didn't get it or missed the notification.  I just stumbled upon this post again today!  Thanks for your detailed analysis.  I just disabled W3 Total Cache.  I wonder if you can see if this has resolved the issue?

P.S - anyway to get an email update for post replies?

Thanks,

Gabriel
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 31, 2015, 11:08:21 AM1/31/15
to mod-pagespeed-discuss
collapse_whitespace appears to be working on your site, and so does defer_javascript.  Both of those filters do not rely on PageSpeed's ability to fetch resources and optimize them -- they only change HTML markup & script ordering.  

However, you have some image-optimization filters that don't seem to be working.  I think this is due to your mod_pagespeed configuration not being enabled to fetch resources over HTTPS yet.  Do you have access to Apache configuration files?  Or only .htaccess?  If you have access only to .htaccess files, then you need to rely on MapOriginDomain or LoadFromFile to be able to optimize your images in mod_pagespeed.

If you have access to your pagespeed.conf file, then you can also enable HTTPS fetching.


-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/b4191508-8b5f-4638-a5bc-dde370694e70%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages