Headers used by mod_pagespeed

50 views
Skip to first unread message

Fernando Campos

unread,
Sep 16, 2015, 3:43:38 PM9/16/15
to mod-pagespeed-discuss
Hello

I am trying to integrate AWS Cloudfront to my website, which runs mod_pagespeed.

When I access the website through Cloudfront, I get a unoptimized version (X-Mod-Pagespeed is not present). If I bypass Cloudfront and access the origin directly, I get the optimized version of my website (X-Mod-Pagespeed is there).

By default, Cloudfront "edits" (changes the value of some, deletes others) the request headers before sending it back to the origin. I suspected that this was preventing mod_pagespeed from working properly. So I went to Cloudfront and made it stop editing the headers (using the Behavior feature). After that, I started getting the optimized version from Cloudfront.

So, my conclusion is that mod_pagespeed needs some headers to work properly. My question is: what headers?

I am asking that because when you instruct Cloudfront to send headers to the origin it starts using the headers as part of the key for the cache. So, ideally, you should use as few headers as possible.

Thank you.
Fernando.


Maksim Orlovich

unread,
Sep 16, 2015, 4:43:19 PM9/16/15
to mod-pagesp...@googlegroups.com
There are some headers that can turn mod_pagespeed off. The standard one that has this effect is:
 Cache-Control: no-transform.
It seems plausible that Cloudfront could send that. Others would be something like:
PageSpeed: off
ModPageSpeed: off
X-PSA-Client-Option: 2
It seems unlikely that they would use those, though.

Some optimizations may also depend on the user-agent, but that shouldn't turn everything off, and integrating UA-dependent stuff with CDN caching of HTML is tricky, since the CDN and mod_pagespeed need to agree on categories.
I don't believe any other incoming header is used. 

--
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/ac5d5a17-6562-4ba9-890b-0a79238b52d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joshua Marantz

unread,
Sep 16, 2015, 4:50:35 PM9/16/15
to mod-pagespeed-discuss
I was thinking when I read your issue that if Cloudfront cached your unoptimized HTML, mod_pagespeed would not even get a chance to run.

-Josh


Fernando Ferreira Campos

unread,
Sep 17, 2015, 11:10:36 AM9/17/15
to mod-pagespeed-discuss
Found the issue: Cloudfront changes the value of the Host header to the associated "Origin Domain Name".

In my case, that name routes to a virtual host that has mod_pagespeed disabled.

Solved the case by explicitly asking Cloudfront (in Behavior configuration) to forward the original Host header.

Thank you
Fernando.








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/cdqNZS-DBR8/unsubscribe.
To unsubscribe from this group and all its topics, 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/CAGKR%2BEC3qOE7Nm7bTvvCaKAoTRTURY3KjLsOqJnaLF5gNQHM6A%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages