【发布时间】:2017-03-10 04:31:24
【问题描述】:
我们在 varnish 后面的多个 apache 节点上运行 mod-pagespeed,它位于处理 https 的 ngnix 后面。
所以所有请求都以http 的形式到达apache,但带有额外的x-proto header。
PageSpeed 在 http 上运行良好,并将 url 重写到所需的 cdn 域,但在 https 请求中无法这样做。
设置:
ModPagespeedRespectXForwardedProto on
ModPagespeedDomain mycdn.azureedge.net
ModPagespeedMapRewriteDomain mycdn.azureedge.net *mydomain.com
mycdn.azureedge.net 是 cdn,mydomain.com 是我的网站。
我完整的 mod_pagespeed 配置 can be found here.
如果我将ModPagespeedRespectXForwardedProto 设置为off,对于https 请求,链接将被重写到cdn,但使用http 作为协议。
我确实设置了一台本地机器(带有 docker)来测试这个本地并遇到同样的问题。您的 Pagespeed 适用于 http,不会为 https 重写 url。如果我使用调试过滤器,即使在 https 请求中也会添加调试信息,因此 Pagespeed 肯定会为这两种协议运行。
我也添加了the stats_log_global output as a pastebin here 和the debug log output from the html here。
如何让 pageSpeed 在 https 请求上也重写这些 url?
【问题讨论】:
标签: apache https cdn mod-pagespeed