apache 和 mod_pagespeed + varnish 问题

apache 和 mod_pagespeed + varnish 问题

我在Web层有以下架构。

Varnish <-> Apache2 (mod_pagespeed <-> mod_jk) <-> Tomcat
    ^          ^                                      ^
    |          |                                      |________: mod_jk
    |          |_______________________________________________: port 8080
    |__________________________________________________________: port 80

其中 varnish 和 mod_pagespeed 采用默认配置安装。

现在当我访问该网址时http://example.org:8080然后我可以在源代码中看到 mod_pagespeed 被调用并重写了页面(第二次刷新时请注意,因为第一次没有被缓存)

但是当我访问该网址时http://example.org:80mod_pagespeed 未被调用,且 html 代码保持不变。

下面显示了每个连接点收到的 http 标头

PORT 80
< Server: Apache/2.2.14 (Ubuntu)
< Set-Cookie: JSESSIONID=95ABA0EB57ACCBE15C9D7035C4397BD3; Path=/
< X-Mod-Pagespeed: 0.9.17.7-716
< Cache-Control: max-age=0, no-cache, no-store
< Vary: Accept-Encoding
< Content-Type: text/html;charset=UTF-8
< Content-Length: 13234
< Date: Wed, 01 Jun 2011 12:17:11 GMT
< X-Varnish: 579414176
< Age: 0
< Via: 1.1 varnish
< Connection: keep-alive

PORT 8080 (mod_pagespeed working fine)
< Date: Wed, 01 Jun 2011 12:19:26 GMT
< Server: Apache/2.2.14 (Ubuntu)
< Set-Cookie: JSESSIONID=DC3759CDE52D3B63A785F9C97B005EC0; Path=/
< X-Mod-Pagespeed: 0.9.17.7-716
< Cache-Control: max-age=0, no-cache, no-store
< Vary: Accept-Encoding
< Content-Length: 15990
< Content-Type: text/html;charset=UTF-8   

有谁知道为什么会发生这种情况吗?这是 mod_pagespeed 中的错误吗?这是由 varnish 或 mod_pagespeed 中设置的配置设置引起的吗?

任何有助于进一步深入研究此问题的帮助都将不胜感激。

答案1

在后端服务器上使用 mod_pagespeed 时,您可能会陷入许多配置陷阱,因为后端服务器接收的 URL 与最终用户看到的 URL 不同。

您的回复都有 X-Mod-Pagespeed:标头,因此 mod_pagespeed 在每个标头上运行,但是,它可能无法加载子资源(CSS、JS、图像),因此不会重写其中任何一个。

请关注[电子邮件保护]我们可以帮助您解决这个问题。

相关内容