3

We are running mod-pagespeed on serveral apache nodes behind a varnish wich sits behind an ngnix which handles https. So all request arrive apache as http but with an extra x-proto header.

PageSpeed works fine on http and rewrites urls to the desired cdn domain, yet fails to do so in https requests.

The settings:

ModPagespeedRespectXForwardedProto on
ModPagespeedDomain mycdn.azureedge.net
ModPagespeedMapRewriteDomain mycdn.azureedge.net *mydomain.com

where mycdn.azureedge.net is the cdn and anything mydomain.com is my website.

My complete mod_pagespeed config can be found here.

If i do set ModPagespeedRespectXForwardedProto to off, for https requests, links are rewritten to the cdn but with http as the protocol.

I did set up a local machine (with docker) to test this localy and have the same problem. Thou Pagespeed works fine for http, urls are not rewritten for https. If i use debug filter, the debug information is added even in https requests so Pagespeed is definitively running for both protocols.

I added the stats_log_global output as a pastebin here and the debug log output from the html here as well.

How do i get pageSpeed to rewrite those urls on https requests as well?

Andresch Serj
  • 35,217
  • 15
  • 59
  • 101

1 Answers1

1

I'm not quite clear on your domains, as you mention example.net and example.com, but they don't appear in your config. Are you serving come content yourself and some via a CDN?

Have you tried setting ModPagespeedMapOriginDomain as suggested in the docs? It looks like you'd need to add the protocol on the front to get the mapping working.

https://developers.google.com/speed/pagespeed/module/https_support#map_the_origin

Do you definitely need to rewrite the domain? It seems like mapping the origin would be sufficient.

Daniel Scott
  • 7,418
  • 5
  • 39
  • 58
  • example.net and example.com are _examples_. – Andresch Serj Nov 03 '16 at 17:40
  • ModPagespeedMapOriginDomain is to handle how data that is altered (compression and such) will be fetched, not how domains are rewritten. – Andresch Serj Nov 03 '16 at 17:41
  • Yes, i do need to rewrite the domain. How would mapping make the end user load data from my cdn? – Andresch Serj Nov 03 '16 at 17:42
  • OK, I'm still not quite clear what the architecture is. Is everything HTTPS? It only some pages. Does only some content come from the CDN, or all of it? Mapping wouldn't help, but it isn't clear from your question that you weren't having a problem with the reverse proxy. – Daniel Scott Nov 03 '16 at 17:49
  • Both http and https exist. All content is on our server. if any asset url is called via the cdn, the cdn copies it from our server, caches it and delivers it. My question was and is: "How do i get pageSpeed to rewrite those urls on https requests as well?". Do you thnk the reverse proxy could be an issue for the rewrite process? The domain rewrite process shouldn't be concerned with where the assets are or how to access them right? – Andresch Serj Nov 04 '16 at 07:58
  • Did you try putting the protocol in front of the domains in the ModPagespeedMapRewriteDomain setting? Or can you not do that because some content is http and some https? – Daniel Scott Nov 04 '16 at 11:08
  • Some content is http and some is https. – Andresch Serj Nov 08 '16 at 13:49