+++ /dev/null
-
-acl rfc1918 {
- 10.0.0.0/8;
- 172.16.0.0/12;
- 192.168.0.0/16;
-}
-
-sub request_policy {
-
- if (client.ip == 10.1.2.3) {
- no_cache;
- finish;
- }
-
- if (client.ip ~ rfc1918) {
- no_cache;
- finish;
- }
-
- if (req.url.host ~ "cnn.no$") {
- rewrite "cnn.no$" "vg.no";
- }
-
- if (req.url.path ~ "cgi-bin") {
- no_cache;
- }
-
- if (req.useragent ~ "spider") {
- no_new_cache;
- }
-
-# comment
-
- if (backend.response_time <= 0.8s) {
- set req.ttlfactor = 1.5;
- } elseif (backend.response_time > 1.5s) {
- set req.ttlfactor = 2.0;
- } elseif (backend.response_time > 2.5m) {
- set req.ttlfactor = 5.0;
- }
-
- /*
- * the program contains no references to
- * maxage, s-maxage and expires, so the
- * default handling (RFC2616) applies
- */
-}
-
-backend vg {
- set backend.ip = 10.0.0.100;
- set backend.timeout = 4s;
- set backend.bandwidth = 2000Mb/s;
-}
-
-backend chat {
- set backend.ip = 10.0.0.4;
- set backend.timeout = 4s;
- set backend.bandwidth = 2000Mb/s;
-}
-
-sub bail {
- error 404 "Bailing out";
- finish;
-}
-
-sub fetch_policy {
-
- if (!req.url.host ~ "/vg.no$/") {
- set req.backend = vg;
- } else {
- /* XXX: specify 404 page url ? */
- error 404;
- }
-
- if (backend.response_time > 2.0s) {
- if (req.url.path ~ "/landbrugspriser/") {
- call bail;
- }
- }
- fetch;
- if (backend.down) {
- if (obj.exist) {
- set obj.ttl += 10m;
- finish;
- }
- switch_config ohhshit;
- }
- if (obj.result == 404) {
- error 300 "http://www.vg.no";
- }
- if (obj.result != 200) {
- finish;
- }
- if (obj.size > 256kb) {
- no_cache;
- } else if (obj.size > 32kb && obj.ttl < 2m) {
- set obj.ttl = 5m;
- }
- if (backend.response_time > 2.0s) {
- set obj.ttl *= 2.0;
- }
-}
-
-sub prefetch_policy {
-
- if (obj.usage < 10 && obj.ttl < 5m) {
- fetch;
- }
-}
+++ /dev/null
-# Manually maintained syntax description of VCL
-#
-# $Id$
-#
-
-vcl_program:
- prog_element
- vcl_program prog_element
-
-prog_element:
- acl
- function
- backend
-
-function:
- 'sub' ident compound
-
-compound:
- '{' statements '}'
-
-statements:
- statement
- statements statement
-
-statement:
- compound
- if_stmt
- action
- 'C{' inline_c_src '}C'
-
-if_stmt:
- 'if' conditional compound elseifparts elsepart
-
-elseifparts:
- <none>
- elseifpart
- elseifparts elseifpart
-
-elseifpart:
- 'elseif' conditional compound
-
-elsepart:
- <none>
- 'else' compound
-
-conditional:
- '(' cond_0 ')'
-
-cond_0:
- cond_1
- cond_0 '||' cond_1
-
-cond_1:
- cond_2
- cond_1 '&&' cond_2
-
-cond_2:
- cond_3
- '!' cond_3
-
-cond_3:
- '(' cond_0 ')'
- var_int cond_int
- var_size cond_size
- var_bool
- var_ip cond_ip
- var_string cond_string
- var_time cond_time
- var_backend
-
-cond_int:
- '==' cnum
- '!=' cnum
- '<=' cnum
- '>=' cnum
- '<' cnum
- '>' cnum
-
-cond_size:
- cond_int size_unit
-
-conf_time:
- cond_int time_unit
-
-time_unit:
- 's'
- 'm'
- 'h'
- 'd'
-
-size_unit:
- 'kb'
- 'mb'
- 'Mb'
- 'gb'
- 'Gb'
-
-cond_string:
- '~' regexp
- '==' cstr
- '!=' cstr
-
-cond_ip:
-
-regexp:
- cstr
-
-backend:
- 'backend' ident '{' be_decls '}'
-
-be_decls:
- be_decl
- be_decls be_decl
-
-be_decl:
- 'set' be_string '=' cstr ';'
- 'set' be_time '=' cnum time_unit ';'
-
-action:
- 'no_new_cache' ';'
- 'no_cache' ';'
- return_action ';'
- 'error' cnum cstr ';'
- 'error' cstr ';'
- 'error' cnum ';'
- 'error' ';'
- 'switch_config' ident ';'
- 'call' ident ';'
- 'rewrite' cstr cstr ';'
- 'set' assignment ';'
- 'remove' variable ';'
-
-# see variable 'returns' in vcc_gen_fixed_token.tcl
-return_action:
- 'lookup'
- 'hash'
- 'pipe'
- 'pass'
- 'fetch'
- 'insert'
- 'deliver'
- 'discard'
-
-assignment:
- var_int ratio
- var_int assign_int
- var_size ratio
- var_size assign_int size_unit
- var_rate ratio
- var_rate assign_int size_unit '/' time_unit
- var_time ratio
- var_time assign_int time_unit
- var_float ratio
- var_float '+=' double
- var_float '-=' double
- var_float '=' double
- var_backend '=' ident
- var_string '=' stringval
- var_string '+=' stringval
-
-assign_int:
- '+=' cnum
- '-=' cnum
- '=' cnum
-
-
-ratio:
- '*=' double
- '/=' double
-
-acl:
- 'acl' ident '{' rules '}'
-
-rules:
- rule
- rules rule
-
-rule:
- '(' not rule0 ')' ';'
- not rule0 ';'
-
-not:
- <nothing>
- '!'
-
-rule0:
- cstr
- cstr '/' cnum
- '!' cstr
-
-stringval:
- cstr
- var_string
-
-cstr: (string constant)
-
-cnum: (numeric constant)
-
-double: (floating point constant)
-
-ident: (identifier)