Python 试图避免清漆缓存

Python 试图避免清漆缓存,python,caching,nginx,request,varnish,Python,Caching,Nginx,Request,Varnish,我试图从客户端避免varnish缓存。在nginx1.6.1中,它可以添加一个随机url参数see 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-Locat

我试图从客户端避免varnish缓存。在nginx1.6.1中,它可以添加一个随机url参数see 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缓存也会被触发并返回命中

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


提前谢谢

我得看看你的vhost。。。但您需要做的可能是确保proxy\u cache\u key指令中有$is\u args$args。还要确保querystring是Varnish端vcl_散列的一部分,尽管我认为这是默认值。谢谢你的回答!遗憾的是,我无法在服务器端工作,这就是为什么我试图在客户端绕过它,而客户端与nginx/1.6.1一起工作,但是如果我访问nginx/1.8.0服务器,随机参数不会起任何作用。