nginx-modules / ngx_cache_purge

nginx module which support to purge ngx_http_(fastcgi|proxy|scgi|uwsgi)_module cache backend
Other
208 stars 33 forks source link

Why might it not be working? #24

Closed pasamsin closed 4 years ago

pasamsin commented 4 years ago

If I visit as below; https://www.domain.com/purge/index.html It gives this message; Successful purge Key : /index.html

If I visit as below; https://www.domain.com/purge/index.html or https://www.domain.com/purge/ It gives this message; Why am I getting an error? 412 Precondition Failed nginx

My configuration is as follows; location ~ /purge(/.*) { allow xxx.xxx.xxx.xxx/24; deny all; proxy_cache_purge domain.com_proxy $1$is_args$args; }

denji commented 4 years ago

To distinguish between the nginx 404 operation and the processing error, the 404 was changed to 412.

412 = purge empty cache 200 = purge cache successful (Successful purge)

https://github.com/nginx-modules/ngx_cache_purge/releases/tag/2.5 (https://github.com/nginx-modules/ngx_cache_purge/commit/14495912201a078553bd91143bef070fec278662).

What returns 200 for Partial Keys is probably a problem if the cache is empty.

pasamsin commented 4 years ago

When I check, there are files with the following key in the cache files, but it continues to give 412 warnings.

KEY: httpsGETwww.domain.com/

pasamsin commented 4 years ago

I tried every seneria. I have tried the following key sequences, but it does not delete the cache without putting the * sign.

proxy_cache_key $scheme$request_method$host$request_uri; proxy_cache_purge domain.com_proxy $scheme$request_method$host$request_uri;

proxy_cache_key $scheme$host$request_uri; proxy_cache_purge domain.com_proxy $scheme$host$request_uri;

proxy_cache_key $host$request_uri; proxy_cache_purge domain.com_proxy $host$request_uri;

KEY: httpsGETwww.domain.com/ KEY: httpsww.domain.com/ KEY: www.domain.com/

pasamsin commented 4 years ago

Yes, the error stems from me. I managed to run it with the following key sequence. I'm happy that it finally worked. thank you for enduring me. @denji

proxy_cache_key $host$request_uri;

location ~ /purge(/.*) { allow xxx.xxx.xxx.xxx/24; deny all; proxy_cache_purge domain.com_proxy $host$1; }