Apache with mod_proxy and mod_pagespeed as a web accelerator / compressing proxy

513 views
Skip to first unread message

Jerzy

unread,
Jan 28, 2016, 10:03:36 AM1/28/16
to mod-pagespeed-discuss
Hello!

I want to build a web accelerator / compressing forward proxy using Apache 2.2 with mod_pagespeed and mod_proxy on my VPS with Debian Jessie x86_64. I will tell you what I have already done and you can tell me if this is correct:
  1. apt-get install apache2 libapache2-mod-proxy-html libxml2-dev
  2. curl -O https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb && dpkg -i mod-pagespeed-*.deb && apt-get -f install
  3. a2enmod proxy proxy_http proxy_html proxy_connect
  4. vi /etc/apache2/mods-enabled/pagespeed.conf and set: ModPagespeedDomain *
  5. vi /etc/apache2/mods-enabled/proxy.conf and set:
    ProxyRequests On
    ProxyVia On
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy *>
  6. service apache2 restart

Is it all? Now when I set the HTTP proxy in the browser to mydomain.com:80, websites load fine with a response headers:

Via: 1.1 mydomain.com
X-Mod-Pagespeed: 1.9.32.11-7550

However, it is not the case with HTTPS pages. How to enable HTTPS proxy with mod_pagespeed?

Joshua Marantz

unread,
Jan 28, 2016, 10:13:30 AM1/28/16
to mod-pagespeed-discuss
Check out this post from Frank Denis a few years ago: https://00f.net/2012/06/02/mod-pagespeed-as-a-proxy-for-your-phone/

I think you just need to add:
    ModPagespeedFetchHttps enable
This is needed because you are using the stable release, 1.9.  In 1.10 (released to beta), that is on by default.

Let us know how it goes!
-Josh


--
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/af88037e-3206-44b5-bcee-f4cb88a6dbdb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jerzy

unread,
Jan 28, 2016, 10:31:46 AM1/28/16
to mod-pagespeed-discuss
Thank you! I have already read this article. However, not everything works fine. I get a lot of 403 Forbidden errors, for e.g. http://edition.i.cdn.cnn.com/.a/1.239.0/css/global.css+pages,_page-blessed2.css+pages,_page-blessed1.css+pages,_page.css.pagespeed.cc.EHk7sLC6km.css, which is issued by Apache/2.4.10 (Debian) Server at edition.i.cdn.cnn.com Port 80. So it seems mod_proxy is forwarding pagespeed request to the origin host. How to prevent this?

Jerzy

unread,
Jan 28, 2016, 11:14:53 AM1/28/16
to mod-pagespeed-discuss
What I also found out is mod_pagespeed works even if I disable mod_proxy and enable some other forwarding proxy like Mozilla Janus or Ziproxy, independent of Apache. How is that possible?

Jerzy

unread,
Jan 28, 2016, 11:43:21 AM1/28/16
to mod-pagespeed-discuss
Sorry, it seems not possible, the remote host I was testing has mod_pagespeed enabled too, which made me think my local mod_pagespeed is working with my other proxy servers.

The question remains, how to get rid of those 403 Forbidden errors when using Apache with mod_pagespeed and mod_proxy?

Joshua Marantz

unread,
Jan 28, 2016, 1:22:12 PM1/28/16
to mod-pagespeed-discuss
So the problem is that your forward proxy is handling a request for 


but PageSpeed is not handling it, but passing it onto the origin, which doesn't know about it.  Is that right?  Can you try that website in isolation with
  loglevel debug
and see what gets printed in the Apache error.log?  That might have some clues as to what's happening with that URL.

On Thu, Jan 28, 2016 at 11:43 AM, Jerzy <jerzyg...@gmail.com> wrote:
Sorry, it seems not possible, the remote host I was testing has mod_pagespeed enabled too, which made me think my local mod_pagespeed is working with my other proxy servers.

The question remains, how to get rid of those 403 Forbidden errors when using Apache with mod_pagespeed and mod_proxy?

--
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.

Jerzy

unread,
Jan 28, 2016, 3:00:19 PM1/28/16
to mod-pagespeed-discuss
Yes, this is the problem. From error.log:

[Thu Jan 28 19:43:20.366036 2016] [authz_core:error] [pid 10980:tid 140717194909440] [client 31.61.136.204:21556] AH01630: client denied by server configuration: uri http://edition.i.cdn.cnn.com/.a/1.239.0/css/global.css+pages,_page-blessed2.css+pages,_page-blessed1.css+pages,_page.css.pagespeed.cc.EHk7sLC6km.css

which is strange since it is a standard Apache 2.4 installation.

That said, I almost fixed the issue by enabling these options:
    ModPagespeedJsPreserveURLs on
    ModPagespeedImagePreserveURLs on
    ModPagespeedCssPreserveURLs on
    ModPagespeedEnableFilters in_place_optimize_for_browser
    ModPagespeedCombineAcrossPaths off
    ModPagespeedAvoidRenamingIntrospectiveJavascript on

The only assets which give 403 errors are some JavaScripts. But CSS and images no longer have their URLs rewritten.

Jerzy

unread,
Feb 1, 2016, 6:31:02 AM2/1/16
to mod-pagespeed-discuss
Does anybody else use mod_pagespeed as a forwarding proxy? What is your configuration?

Joshua Marantz

unread,
Feb 1, 2016, 9:38:21 AM2/1/16
to mod-pagespeed-discuss
Searching for the specific error you found ("AH01630"), I came across this on stack overflow: http://stackoverflow.com/questions/18392741/apache2-ah01630-client-denied-by-server-configuration .  The remedies described there are probably worth a shot.

In any case, running with the 'preserve URLs' option is probably a good idea for a forward proxy.  While sites that install mod_pagespeed can correct any problems that arise with JavaScript introspection of URLs by using "ModPagespeedDisallow", that's not going to be easy when you are setting up a forward proxy.  This is in fact why those 'preserve' options were originally created.

-Josh

On Mon, Feb 1, 2016 at 6:31 AM, Jerzy <jerzyg...@gmail.com> wrote:
Does anybody else use mod_pagespeed as a forwarding proxy? What is your configuration?

--
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.
Reply all
Reply to author
Forward
0 new messages