nginx-helper icon indicating copy to clipboard operation
nginx-helper copied to clipboard

Purge Entire Cache action uses wrong purge method

Open akansc opened this issue 1 year ago • 8 comments

The module seems to have 2 purge modes: image

The GET PURGE/url method works fine when saving single posts and whatnot, however, the the "Purge Entire Cache" seem to execute the unlink_recursive function which of course fails on a shared hosting server due to insufficient permissions.

Allowing shared hosting users to reach and manipulate the global fcgi cache is not an option and would be considered as a security issue.

The PURGE/* wildcard is supported since the 2.4 that was released in 2016, that would still work with all your nginx examples: https://github.com/nginx-modules/ngx_cache_purge/releases

akansc avatar Jan 23 '24 12:01 akansc

@gagan0123

I was disappointed to see this wasn't included in the latest update. I'm also effected by the issue above.

Are there any plans to add the PURGE/* now this it's supported?

https://github.com/nginx-modules/ngx_cache_purge/releases/tag/2.4

qcybb avatar Apr 16 '24 16:04 qcybb

I am currently testing fastcgi cache and nginx helper and noticed the same issue. Purging Entire Cache does not work for our isolated users. Since we use the /PURGE/ URL, @akansc 's suggestion would work for us as well

JoAllg avatar Jun 26 '24 15:06 JoAllg

That seems to be an old known issue. https://github.com/rtCamp/nginx-helper/pull/306

JoAllg avatar Jun 28 '24 06:06 JoAllg

Working on this too, pulled other fork

Wrote this 6 years ago, other fork is bringing into nginx helper

https://github.com/JeffCleverley/NginxFastCGICachePurger

The curl functions require 5.5+ and nginx helper is set for 5.4 + compatibility, so im going to take the above fork and add a php guard...

Im also adding socket and other connection option supports.

gridpane avatar Jun 29 '24 06:06 gridpane

I have completed work on a fork here:

https://github.com/gridpane/nginx-helper

Settings can be configured by wp-admin or using constants

I have put in a guard to check for PHP version, since the curl option required is only available in 5.5+ and plugin is set to allow older versions...

Pulled in work from my old plugin and the pull above: https://github.com/rtCamp/nginx-helper/pull/306

Screenshot 2024-06-29 at 22 26 31 Screenshot 2024-06-29 at 22 27 11

Going to complete testing on our platform and will make PR.

gridpane avatar Jun 29 '24 14:06 gridpane

https://github.com/rtCamp/nginx-helper/pull/344

gridpane avatar Jun 29 '24 15:06 gridpane

Thank you, I hope this gets added in soon.

qcybb avatar Jun 29 '24 17:06 qcybb

I appreciate it as well @gridpane

JoAllg avatar Jul 02 '24 11:07 JoAllg