Purge the Nginx cache

Francis Daly francis at daoine.org
Tue May 3 08:26:06 UTC 2022


On Fri, Apr 29, 2022 at 12:54:42AM +0530, Kaushal Shriyan wrote:

Hi there,

> I am following
> https://www.ryadel.com/en/nginx-purge-proxy-cache-delete-invalidate-linux-centos-7/
> and https://bluegrid.io/edu/how-to-purge-the-nginx-cache/ to purge cache. I
> am attaching the nginx file for your reference.

It's probably best to follow exactly one document, to avoid any confusion
from mixing things.

I think that you are following the second one here with its method number
2, using the stock nginx proxy_cache_bypass directive.

> $curl -I https://gsmanginxproxycachepurge.testapicraft.com -H
> "secret-header: true"

> *X-Cache-Status: HIT*
> 
> I am seeing it as HIT instead of BYPASS and I am not sure about this term
> between HIT vs MISS vs BYPASS vs EXPIRED in context to Nginx cache.

Your configuration for https://gsmanginxproxycachepurge.testapicraft.com
reads the $bypass variable if it is set; but it never sets it, so it will
be read as "empty", and the proxy_cache_bypass directive will *not*
cause the cache to be bypassed in this case.

If you want to use this method, you must ensure that your $bypass variable
is set for the one request that you are making.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list