apache / incubator-pagespeed-ngx

Automatic PageSpeed optimization module for Nginx
http://ngxpagespeed.com/
Apache License 2.0
4.37k stars 363 forks source link

Recommended setup for reverse-proxy #1753

Open luison opened 2 years ago

luison commented 2 years ago

Hi. We've been using mod_pagespeed for a while on our nginx reverse proxy balancer.

We have now performed some important changes removing apache on the upstream and migrating rewrites rules and I am wondering if someone with a similar setup (reverse-proxy to upstreams) could point me at the right way to configure it.

The current mod_pagespeed nginx:

So to clarify, from the proxy server point of view:

Been so, for a long time our doubts on the correct setup are:

  1. should upstream1 (different container now also running nginx) also be running mod_pagespeed, would that benefit at all if mainly serving php files there?
  2. should mod_pagespeed also be activated on "cdn.domain.com" in the main reverse proxy, so it can be handled by "domain.com"? Can I do that (currently log full of: No permission to rewrite 'https://cdn.domain.com/asserts-dir/bootstrap.min.css'

I've been struggling to understand how to allow mod_pagespeed to rewrite also the content from our cdn served on another server of the same nginx. See: https://groups.google.com/g/mod-pagespeed-discuss/c/B5lLUa-GgsU

The (new) issues that come up are that the "friendly" urls are no longer available on the upstream, so not sure if pagespeed would handle that correctly.

Also had issues with extended_cache and source files updates: https://github.com/apache/incubator-pagespeed-ngx/issues/1626