apache / incubator-pagespeed-ngx

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

I cannot get ngx_pagespeed to purge the cache #1509

Open debanjanbasu opened 6 years ago

debanjanbasu commented 6 years ago

Here is the configuration that I am using for NGINX as a reverse proxy and cache. Can anyone please help me to fix the issue of mod_pagespeed unable to purge the cache. It shows the cache is purged, but when I'm accessing the page, the markup hasn't changed.

Here is my NGINX conf

https://pastebin.com/2p7kt2XJ

debanjanbasu commented 6 years ago

Can anyone please help. We are ready to have some rewards for this too.

Lofesa commented 6 years ago

Had commercial license of nginx? Some of the cache directives you use are for comercial license of nginx, for example poxy_cache_purge unless you use a free version of it as stated in the pagespeed doc ( https://github.com/FRiCKLE/ngx_cache_purge). Had you read the upstream cache config of pagespeed? The config stated here is not the same you use

debanjanbasu commented 6 years ago
  1. We can use the proxy cache purge module by compiling NGINX from source. There is no license needed for it.

  2. I had read and implemented the default upstream cache code from the document in vain. There is something missing or not clearly documented maybe. Has anyone ever actually got to make these two things work together properly? The varnish caches might work, but the NGINX demo config is definitely not working.

  3. The ngx_cache_purge is actually working fine without the pagespeed module, running just a reverse proxy.

oschaaf commented 6 years ago

Do you see any PURGE requests in the access logs?

debanjanbasu commented 6 years ago

I am seeing the Purge requests coming into the server from my desktop. This does get a 200OK and a message "Purge successful". However, the next stage appears to be broken, and it is not sending any further request to the downstream cache purge. Is there something that I'm missing? My downstream is on http2, in fact everything in the config now is on http2. Would that affect the scenario?

oschaaf commented 6 years ago

H/2 shouldn't affect this I think. The purge will land on a different server block and not on the proxy cache. It looks like the intent is for these servers to share the same cache space, but I wonder if the hostnames diverge when purging and requesting html? Are you sure they end up with the same proxy cache key?