I will stop bothering the helpful guys at the irc for a minute and ask a
question here ;)
My VCL conf looks like this:
sub vcl_recv {
#Change the host header to www.mysite.com
if(req.http.host == "10.1.1.54" || req.http.host == "test.mysite.com") {
set req.http.host = "www.mysite.com";
}
#Purge specified files from acl purge.
#Purge = Delete the specified url from the cache
if(req.request == "PURGE") {
if(client.ip ~ purge) {
purge_url(req.url);
}
}
sub vcl_miss {
#set http version 1.1
set bereq.proto = "HTTP/1.1";
if (req.request == "PURGE") {
error 404 "The url could not be found in the cache.";
}
}
sub vcl_hit {
if (req.request == "PURGE") {
set obj.ttl = 0s;
error 200 "Purged successfully!";
}
}
}
# End of VCL Conf
I receive a 404 error "The url could not be found in the cache." when I try to
PURGE the url.
PURGE http://www.mysite.com/data/hello.gif HTTP/1.1
This is the varnishlog when I try to purge:
12 RxRequestc PURGE
12 RxURLc /data/hello.gif
12 RxProtocol c HTTP/1.1
12 VCL_call c recv
12 VCL_acl c MATCH purge "84.xx.xx.xx"
12 VCL_return c lookup
12 VCL_call c hash
12 VCL_return c hash
12 Debugc "Hash: /data/hello.gif#10.1.1.54:80#"
12 VCL_call c miss
0 Debug "VCL_error(404, The url could not be found in the cache.)"
12 VCL_return c error
12 Length c 453
12 TxProtocol c HTTP/1.0
12 TxStatus c 404
12 TxResponse c Not Found
12 TxHeader c Server: Varnish
12 TxHeader c Retry-After: 0
12 TxHeader c Content-Type: text/html; charset=utf-8
12 TxHeader c Content-Length: 453
12 TxHeader c Date: Thu, 13 Dec 2007 11:34:50 GMT
12 TxHeader c X-Varnish: 1188471893
12 TxHeader c Age: nan
12 TxHeader c Via: 1.1 varnish
12 TxHeader c Connection: keep-alive
When I try to request it with GET i receive:
12 ReqStart c 84.xx.xx.xx 32162 1188471894
12 RxRequestc GET
12 RxURLc /data/hello.gif
12 RxProtocol c HTTP/1.1
12 RxHeader c Host: www.mysite.com
12 RxHeader c User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1;
sv-SE; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
12 RxHeader c Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
12 RxHeader c Accept-Language: sv,en-us;q=0.7,en;q=0.3
12 RxHeader c Accept-Encoding: gzip,deflate
12 RxHeader c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
12 RxHeader c Keep-Alive: 300
12 RxHeader c Connection: keep-alive
12 RxHeader c
Cookie:__utma=75765975.864378540.1197378455.1197453843.1197535348.6;
12 VCL_call c recv
12 VCL_return c lookup
12 VCL_call c hash
12 VCL_return c hash
12 Debugc "Hash Match: /data/hello.gif#www.mysite.com#"
12 Hit c 1188471893
12 VCL_call c hit
12 VCL_return c deliver
12 Length c 905
12 VCL_call c deliver
12 VCL_return c deliver
12 TxProtocol c HTTP/1.1
12 TxStatus c 200
12 TxResponse c OK
12 TxHeader c Server: Zeus/4.3
12 TxHeader c Content-Type: image/gif
12 TxHeader c Content-Language: sv-SE
12 TxHeader c Content-Length: 905
12 TxHeader c Date: Thu, 13 Dec 2007 11:37:26 GMT
12 TxHeader c X-Varnish: 1188471894 1188471893
12 TxHeader c Age: 43
12 TxHeader c Via: 1.1 varnish
12 TxHeader c Connection: keep-alive
The strange thing is that the host is different in PURGE Match and GET Match. I
have used the same host on both requests. Does it have anything to do with the
vcl code where Im changing the hostheader?
/ Erik
___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc