尽量避免油漆cach

2024-03-29 01:43:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图从客户端避免清漆缓存。在nginx1.6.1中,它可以添加一个随机url参数(参见X-XHR-Current-Location),这样就不会得到“X-Cache”:“HIT”。你知道吗

Server: nginx/1.6.1
Date: Fri, 04 Sep 2015 13:13:02 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 20762
Status: 200 OK
X-XHR-Current-Location: /shop.json?1441372381.857126?1441372381.854355
X-UA-Compatible: IE=Edge,chrome=1
ETag: "de6da75aa7b7d6ce34bd736ccf991f36"
X-Request-Id: a39fc3b8d44687039a18499dd22a2c7d
X-Runtime: 0.371739
X-Rack-Cache: miss
Accept-Ranges: bytes
X-Varnish: 534989417
Age: 0
Via: 1.1 varnish
Cache-Control: private, max-age=0, must-revalidate
Pragma: no-cache
X-Cache: MISS
X-Cache: MISS from localhost
X-Cache-Lookup: MISS from localhost:3128
Connection: close

但是只要我在nginx/1.8.0服务器上发出请求,URL就会以某种方式被分条(参见X-XHR-Current-Location),随机参数就会被删除。同时,“X-Cache”被触发并返回“HIT”。你知道吗

Server: nginx/1.8.0
Date: Fri, 04 Sep 2015 13:13:14 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 3555
Status: 200 OK
X-XHR-Current-Location: /shop/301316.json
X-UA-Compatible: IE=Edge,chrome=1
ETag: "2e88dffe16a385872368e19e0370a999"
X-Request-Id: 3404c637c6a499d8e32a6e5c243e4d69
X-Runtime: 0.065267
X-Rack-Cache: miss
Accept-Ranges: bytes
X-Varnish: 561085217 561069463
Age: 823
Via: 1.1 varnish
Cache-Control: private, max-age=0, must-revalidate
Pragma: no-cache
X-Cache: HIT
X-Cache: MISS from localhost
X-Cache-Lookup: MISS from localhost:3128
Connection: close

我想这也是我有时得到旧结果的原因。有没有什么方法可以避免“命中”或者假装是nginx/1.8.0服务器的新URL?你知道吗

提前谢谢!你知道吗


Tags: fromjsonlocalhostcache参数dateservernginx