Ipstenu / varnish-http-purge

Proxy Cache Purge
Apache License 2.0
46 stars 47 forks source link

purge page when comment was approved #13

Closed shaula closed 8 years ago

shaula commented 9 years ago

When a comment status changes, then the respective page should be purged (works in an environment where each comment has to be approved).

Ipstenu commented 9 years ago

This should be totally unnecessary. The plugin does this via the edit_post action

Runs when a post or page is updated/edited, including when a comment is added or updated (which causes the comment count for the post to update).

So that should cover it. Are you using other plugins to mess with comments? I tested on a vanilla WP and it behaves as designed.

Also URL params aren't supposed to be cached by Varnish anyway, so you're doing something odd with your Varnish Rules.

shaula commented 9 years ago

Did not know about the behavior of edit_post action. You're right.

Regarding GET parameters: I think any GET resource should be cacheable. On the one hand Wordpress could be used with GET params ?p=123 as well as without (pretty Urls). On the other hand ajax requests using GET parameters should be cached by Varnish if requested so by the backend (i.e. if the backend script sets appropriate caching headers).

In my vcl_hash function I got: hash_data(req.url); ...and this req.url also includes GET parameters. So, nothing fancy here I guess.

Ipstenu commented 9 years ago

On the other hand, though, a GET resource could also be a nonce (not something you want to cache) or a unique string to identify a subscription change. They're really tricky :/

Also the plugin will alert you "I don't work without pretty permalinks" ;)

I'm going to test the query string and see if causes other weirdness. It shouldn't HURT anything but thinking about what query params are used for with WordPress, it's an odd thing to need.

Ipstenu commented 8 years ago

Closing this, since the query URL one is the right one to follow.