Skip to content

Instantly share code, notes, and snippets.

@leafo
Created August 14, 2014 22:24
Show Gist options
  • Save leafo/eebe79e0528c590e98df to your computer and use it in GitHub Desktop.
Save leafo/eebe79e0528c590e98df to your computer and use it in GitHub Desktop.
* << BeReq >> 32771
- Begin bereq 32770 fetch
- Timestamp Start: 1408054950.451976 0.000000 0.000000
- BereqMethod GET
- BereqURL /dump/Music%20Pack.rar
- BereqProtocol HTTP/1.1
- BereqHeader User-Agent: curl/7.37.1
- BereqHeader Accept: */*
- BereqHeader X-Forwarded-For: 206.169.213.106
- BereqHeader Host: leafo.net
- BereqHeader Accept-Encoding: gzip
- BereqHeader X-Varnish: 32771
- VCL_call BACKEND_FETCH
- VCL_return fetch
- BackendOpen 15 default(198.252.98.201,,80) 173.255.218.206 42648
- Backend 15 default default(198.252.98.201,,80)
- Timestamp Bereq: 1408054950.498552 0.046576 0.046576
- Timestamp Beresp: 1408054950.558687 0.106711 0.060135
- BerespProtocol HTTP/1.1
- BerespStatus 200
- BerespReason OK
- BerespHeader Date: Thu, 14 Aug 2014 22:22:28 GMT
- BerespHeader Server: LiteSpeed
- BerespHeader Accept-Ranges: bytes
- BerespHeader Connection: close
- BerespHeader ETag: "f701075-5112a8ac-d5c59c75a02ea2ed"
- BerespHeader Last-Modified: Wed, 06 Feb 2013 19:02:04 GMT
- BerespHeader Content-Type: application/x-rar-compressed
- BerespHeader Content-Length: 259002485
- TTL RFC 120 -1 -1 1408054951 1408054951 1408054948 0 0
- VCL_call BACKEND_RESPONSE
- BerespUnset Last-Modified: Wed, 06 Feb 2013 19:02:04 GMT
- TTL VCL 604800 10 0 1408054951
- VCL_return deliver
- Storage file s0
- ObjProtocol HTTP/1.1
- ObjStatus 200
- ObjReason OK
- ObjHeader Date: Thu, 14 Aug 2014 22:22:28 GMT
- ObjHeader Server: LiteSpeed
- ObjHeader ETag: "f701075-5112a8ac-d5c59c75a02ea2ed"
- ObjHeader Content-Type: application/x-rar-compressed
- Fetch_Body 3 length stream
- ExpKill LRU_Cand p=0x7f100c000930 f=0x0 r=3
- ExpKill LRU_Fail
- FetchError Could not get storage
- BackendClose 15 default(198.252.98.201,,80)
- BereqAcct 169 0 169 276 104730624 104730900
- End
* << Request >> 32770
- Begin req 32769 rxreq
- Timestamp Start: 1408054950.451896 0.000000 0.000000
- Timestamp Req: 1408054950.451896 0.000000 0.000000
- ReqStart 206.169.213.106 59980
- ReqMethod GET
- ReqURL /dump/Music%20Pack.rar
- ReqProtocol HTTP/1.1
- ReqHeader User-Agent: curl/7.37.1
- ReqHeader Host: itch.zone:9994
- ReqHeader Accept: */*
- ReqHeader X-Forwarded-For: 206.169.213.106
- VCL_call RECV
- ReqUnset Host: itch.zone:9994
- ReqHeader Host: leafo.net
- VCL_return hash
- VCL_call HASH
- VCL_return lookup
- Debug "XXXX MISS"
- VCL_call MISS
- VCL_return fetch
- Link bereq 32771 fetch
- Timestamp Fetch: 1408054950.558940 0.107043 0.107043
- RespProtocol HTTP/1.1
- RespStatus 200
- RespReason OK
- RespHeader Date: Thu, 14 Aug 2014 22:22:28 GMT
- RespHeader Server: LiteSpeed
- RespHeader ETag: "f701075-5112a8ac-d5c59c75a02ea2ed"
- RespHeader Content-Type: application/x-rar-compressed
- RespHeader X-Varnish: 32770
- RespHeader Age: 0
- RespHeader Via: 1.1 varnish-v4
- VCL_call DELIVER
- VCL_return deliver
- Timestamp Process: 1408054950.558957 0.107061 0.000017
- Debug "RES_MODE 8"
- RespHeader Transfer-Encoding: chunked
- RespHeader Connection: keep-alive
- RespHeader Accept-Ranges: bytes
- Timestamp Resp: 1408054962.961004 12.509108 12.402047
- Debug "XXX REF 1"
- ReqAcct 99 0 99 283 104734504 104734787
- End
* << Session >> 32769
- Begin sess 0 HTTP/1
- SessOpen 206.169.213.106 59980 0.0.0.0:9994 173.255.218.206 9994 1408054950.451837 12
- Link req 32770 rxreq
- SessClose REM_CLOSE 12.509
- End
#
vcl 4.0;
acl admin {
"localhost";
}
backend default {
.host = "leafo.net";
.port = "80";
}
sub vcl_recv {
set req.http.Host = "leafo.net";
unset req.http.Cookie;
unset req.http.Cache-Control;
unset req.http.Accept-Encoding;
unset req.http.Pragma;
if (req.method == "DELETE") {
if (client.ip ~ admin) {
ban("req.url ~ ^" + regsub(req.url, "\?.*", ""));
return(synth(200, "Banned :)"));
}
}
}
sub vcl_hash {
# only hash the path of the file
hash_data(regsub(req.url, "\?.*", ""));
if (req.http.host) {
hash_data(req.http.host);
} else {
hash_data(server.ip);
}
return (lookup);
}
sub vcl_backend_response {
# mark as hit for pass
if (beresp.status != 200) {
set beresp.uncacheable = true;
set beresp.ttl = 20s;
return (deliver);
}
set beresp.do_stream = true; # this is the default btw
# Cache forever
unset beresp.http.Expires;
unset beresp.http.Last-Modified;
unset beresp.http.Vary;
unset beresp.http.Cache-Control;
unset beresp.http.Set-Cookie;
set beresp.ttl = 1w;
return (deliver);
}
sub vcl_deliver {
unset resp.http.Cache-Control;
}
/usr/bin/varnishd -a 0.0.0.0:9994 -f configs/storage.vcl -T localhost:6082 -s file -u leafo -g users -F
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment