Ipstenu / varnish-http-purge

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

Allow clear cache for Url with query and Regex #81

Closed marcofbb closed 5 years ago

marcofbb commented 5 years ago

Example clear URL: http://domain.com/?parameter1=.*&parameter2=.*

Ipstenu commented 5 years ago

What does this fix?

The majority (if not all) of proxy caches don't cache anything with the query strings.

marcofbb commented 5 years ago

Hello, It really is not a fix. It is an aggregate, if I was trying to add that when a post is created, all the urls that begin with are deleted: http://domain.com/?parameter1=IDPOST&

You would have to put: http://domain.com/?parameter1=IDPOST&?vhp-regex

The problem is that as it is done now it does not take the deletion of said REGEX form cache. Then edit the plugin to identify the pattern. To put REGEX and thus be able to clear the cache of URLs that match the pattern. Then I have a URL deleted when a post is created: http://domain.com/?parameter1=.

Added: In my case I use query for different actions, so what I do is sort the query string and limit it in varnish

regards

Ipstenu commented 5 years ago

Looking into this, Varnish (and nginx) doesn't cache parameters like that by default.

That is domain.com/page/ would be cached, but not domain.com/page?param=value

And in both cases, domain.com/page?vhp-regex purges everything under page so by stripping the variables (which it should be doing right now) that would be covered.

I'd be willing to accept this if you wanted to change it to a filter to add in what you want, but not as a standard. That wouldn't help most users.