Question about proxy_cache_key
Dewangga Bachrul Alam
dewanggaba at xtremenitro.org
Thu Feb 16 06:58:12 UTC 2017
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Example:
[dominique at galea ~]$ curl -I
"http://networksninja/artikel/berita/a-pen-by-hair"
HTTP/1.1 200 OK
Server: networksninja
Date: Thu, 16 Feb 2017 06:48:13 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
Vary: Accept-Encoding
Set-Cookie: PHPSESSID=ddkfbo9jd6bhkhhbknkd4pq854; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache
Cache-Control: no-cache
X-Cache: MISS
[dominique at galea ~]$ curl -I
"http://networksninja/artikel/berita/a-pen-by-hair"
HTTP/1.1 200 OK
Server: networksninja
Date: Thu, 16 Feb 2017 06:48:14 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
Vary: Accept-Encoding
Set-Cookie: PHPSESSID=ddkfbo9jd6bhkhhbknkd4pq854; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache
Cache-Control: no-cache
X-Cache: HIT
[dominique at galea ~]$ curl -X PURGE
"http://networksninja/artikel/berita/a-pen-by-hair"
<html>
<head><title>Successful purge</title></head>
<body bgcolor="white">
<center><h1>Successful purge</h1>
<br>Key : /artikel/berita/a-pen-by-hair?view=desktop
<br>Path:
/var/cache/nginx/networksninja_cache/f/bf/f3863443c164cdfa95f6fe870be7db
ff
</center>
<hr><center>nginx/1.11.10</center>
</body>
</html>
On 02/16/2017 01:08 PM, Dewangga Bachrul Alam wrote:
> Hello!
>
> I've compiled latest nginx 1.11.10 with ngx_cache_purge, my
> configurations likes:
>
> proxy_cache_key "$uri$is_args$args"; proxy_cache_path
> /var/cache/nginx/proxy_cache levels=1:2
> keys_zone=networksninja_cache:60m inactive=60m use_temp_path=off
> max_size=8192m;
>
> And location syntax is :
>
> location / { proxy_pass http://10.8.0.10:80; proxy_cache
> networksninja_cache; proxy_cache_purge PURGE;
> proxy_cache_use_stale error timeout updating http_500 http_503
> http_504; proxy_cache_valid 200 302 5m; proxy_cache_valid any 3s;
> proxy_cache_lock on; proxy_cache_revalidate on;
> proxy_cache_min_uses 1; proxy_cache_bypass $arg_clear;
> proxy_no_cache $arg_clear; proxy_ignore_headers
> Cache-Control Expires Set-Cookie; rewrite (?<capt>.*)
> $capt?$args&view=$mobile break; }
>
> My question is, the URI
> https://subdomain.domain.tld/artikel/berita/a-pen-by-hair accessed
> from another browser (eg. Safari) and cache status was HIT, then I
> tried to invoke `PURGE` command from shell using cURL, it was
> failed and return cache_key not found
>
> But, if the URI accessed from shell using cURL and PURGE command
> was invoke from shell too, the cache_key found, but returning only
> like this :
>
> <html> <head><title>Successful purge</title></head> <body
> bgcolor="white"> <center><h1>Successful purge</h1> <br>Key :
> /artikel/berita/a-pen-by-hair&view=desktop? <br>Path:
> /var/cache/nginx/proxy_cache/a/5e/7527d90390275ac034d4a3d5b2e485ea
> </center> <hr><center>nginx/1.11.10</center> </body> </html>
>
> The following argument "&view=desktop?" should be follow. Is there
> any hints to match the proxy_cache_key? So I can purge the cache
> anywhere and anytime?
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQI4BAEBCAAiBQJYpU2BGxxkZXdhbmdnYWJhQHh0cmVtZW5pdHJvLm9yZwAKCRDl
f9IgoCjNcMLYD/9roaDzgiqMkISbOVt/upKenciszjrjAs1/1UgKB8R82+gTTRV6
UHburcH4Y90NhXL+8jUscHI1Ln3ehj0UL6SubWkcqtR5ezroE9paj/qh6yxnn4UA
clc7SH8rKYwWCm/r7BfN8IvBVVYqLuD/m3EHj50QX3Y0g6g/dE92ij5wKKBXOR1B
Wf+jSl66zHWZtBDbcvK60FUYHKEGkA94scbQL13v+jd+EUNG+ULMK0usu0CLFYKx
+VeDcfoTO5cqPGRupi3EvMK6cAGde1OwnHQdALZZEaTbme+JXNMUJYK/mh4f2duU
4BYhJbdR2Dj1OQavDFOyOGXv+Ui3AI85BV3m0CqhqJO383lpwAvAnzV+xGjSkjbA
7alpO8d/hDQfR4/JQ6gFnwGD/S3t6bre9I6w0kjHvWVNRq4AXL0fYs3JL9X+oTno
PNEH8puGC2miNIGbh8vFlznpfVJh7m1GxyyDYffuQyygt3fxSyu/zzDaRz4+RMNY
wbiCfRC7vlBI8UVY0kpS1Nz4e7EHBk33TWuxLHLRtyJqgEWdRaMprj3rKGBj17RU
VzhTj/fcjiqwB565uWPcKHIG7eMXpygMwf05guTbxKuXiUUK3MBXOWpwyN8EPqIi
6HX59SmfHmE74Fl7AOcrB+cyRJtJODnsECKwIyNEpppRzhMr+gsrwVsJBQ==
=xdSV
-----END PGP SIGNATURE-----
More information about the nginx
mailing list