Welcome! Log In Create A New Profile

Advanced

Re: Doing a mass purge of the cache using a wildcard

Maxim Dounin
October 07, 2019 08:40AM
Hello!

On Fri, Oct 04, 2019 at 12:25:22PM -0500, Jordan Keith wrote:

> We are using nginx plus.

Just to make sure you know: contacting support might be a
better/faster option if you are using nginx-plus.

> We have caching configured for a few endpoints, one which is similar to the following:
>
> document/{id}/report
>
> I would like to purge all items cached under that endpoint, but executing a purge request like the following does not purge anything:
>
> document/*/report
>
> We have other endpoints where mass purges work fine, but they have the * at the end of the URL instead of the middle.
>
> So I have 2 questions:
>
> 1). Does nginx only support wildcards at the end of the URL for cache-purging purposes?

Quoting http://nginx.org/r/proxy_cache_purge:

: If the cache key of a purge request ends with an asterisk (“*”), all cache
: entries matching the wildcard key will be removed from the cache.

Note "ends with" - only wildcards at the end of the cache key are
supported. This doesn't mean "at the end of the URL" though, as
cache keys can be arbitrary configured (see
http://nginx.org/r/proxy_cache_key).

> 2). Is there some other way I can accomplish a mass purge here?

If you want to purge resources like this on a regular basis,
re-structuring your proxy_cache_key might be an option. For
example, you may split "document/{id}/report" into "document/{id}"
and "/report", and put "/report" into the cache key first.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Doing a mass purge of the cache using a wildcard

Jordan Keith October 04, 2019 01:26PM

Re: Doing a mass purge of the cache using a wildcard

Maxim Dounin October 07, 2019 08:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 323
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready