~ubuntu-branches/ubuntu/lucid/varnish/lucid-updates

« back to all changes in this revision

Viewing changes to etc/default.vcl

  • Committer: Bazaar Package Importer
  • Author(s): Stig Sandbeck Mathisen
  • Date: 2010-03-24 13:26:08 UTC
  • mfrom: (0.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100324132608-4uzkavctn26bdwyi
Tags: 2.1.0-1
* New upstream version
* Fix small error in man/vcl.7so

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#This is a basic VCL configuration file for varnish.  See the vcl(7)
2
 
#man page for details on VCL syntax and semantics.
3
 
#
4
 
#Default backend definition.  Set this to point to your content
5
 
#server.
6
 
#
7
 
#backend default {
8
 
#.host = "127.0.0.1";
9
 
#.port = "8080";
10
 
#}
11
 
#
12
 
#Below is a commented-out copy of the default VCL logic.  If you
13
 
#redefine any of these subroutines, the built-in logic will be
14
 
#appended to your code.
15
 
#
16
 
#sub vcl_recv {
17
 
#    if (req.request != "GET" &&
18
 
#      req.request != "HEAD" &&
19
 
#      req.request != "PUT" &&
20
 
#      req.request != "POST" &&
21
 
#      req.request != "TRACE" &&
22
 
#      req.request != "OPTIONS" &&
23
 
#      req.request != "DELETE") {
24
 
#        /* Non-RFC2616 or CONNECT which is weird. */
25
 
#        return (pipe);
26
 
#    }
27
 
#    if (req.request != "GET" && req.request != "HEAD") {
28
 
#        /* We only deal with GET and HEAD by default */
29
 
#        return (pass);
30
 
#    }
31
 
#    if (req.http.Authorization || req.http.Cookie) {
32
 
#        /* Not cacheable by default */
33
 
#        return (pass);
34
 
#    }
35
 
#    return (lookup);
36
 
#}
37
 
#
38
 
#sub vcl_pipe {
39
 
#    # Note that only the first request to the backend will have
40
 
#    # X-Forwarded-For set.  If you use X-Forwarded-For and want to
41
 
#    # have it set for all requests, make sure to have:
42
 
#    # set req.http.connection = "close";
43
 
#    # here.  It is not set by default as it might break some broken web
44
 
#    # applications, like IIS with NTLM authentication.
45
 
#    return (pipe);
46
 
#}
47
 
#
48
 
#sub vcl_pass {
49
 
#    return (pass);
50
 
#}
51
 
#
52
 
#sub vcl_hash {
53
 
#    set req.hash += req.url;
54
 
#    if (req.http.host) {
55
 
#        set req.hash += req.http.host;
56
 
#    } else {
57
 
#        set req.hash += server.ip;
58
 
#    }
59
 
#    return (hash);
60
 
#}
61
 
#
62
 
#sub vcl_hit {
63
 
#    if (!obj.cacheable) {
64
 
#        return (pass);
65
 
#    }
66
 
#    return (deliver);
67
 
#}
68
 
#
69
 
#sub vcl_miss {
70
 
#    return (fetch);
71
 
#}
72
 
#
73
 
#sub vcl_fetch {
74
 
#    if (!obj.cacheable) {
75
 
#        return (pass);
76
 
#    }
77
 
#    if (obj.http.Set-Cookie) {
78
 
#        return (pass);
79
 
#    }
80
 
#    set obj.prefetch =  -30s;
81
 
#    return (deliver);
82
 
#}
83
 
#
84
 
#sub vcl_deliver {
85
 
#    return (deliver);
86
 
#}
87
 
#
88
 
#sub vcl_discard {
89
 
#    /* XXX: Do not redefine vcl_discard{}, it is not yet supported */
90
 
#    return (discard);
91
 
#}
92
 
#
93
 
#sub vcl_prefetch {
94
 
#    /* XXX: Do not redefine vcl_prefetch{}, it is not yet supported */
95
 
#    return (fetch);
96
 
#}
97
 
#
98
 
#sub vcl_timeout {
99
 
#    /* XXX: Do not redefine vcl_timeout{}, it is not yet supported */
100
 
#    return (discard);
101
 
#}
102
 
#
103
 
#sub vcl_error {
104
 
#    set obj.http.Content-Type = "text/html; charset=utf-8";
105
 
#    synthetic {"
106
 
#<?xml version="1.0" encoding="utf-8"?>
107
 
#<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
108
 
# "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
109
 
#<html>
110
 
#  <head>
111
 
#    <title>"} obj.status " " obj.response {"</title>
112
 
#  </head>
113
 
#  <body>
114
 
#    <h1>Error "} obj.status " " obj.response {"</h1>
115
 
#    <p>"} obj.response {"</p>
116
 
#    <h3>Guru Meditation:</h3>
117
 
#    <p>XID: "} req.xid {"</p>
118
 
#    <hr>
119
 
#    <address>
120
 
#       <a href="http://www.varnish-cache.org/">Varnish cache server</a>
121
 
#    </address>
122
 
#  </body>
123
 
#</html>
124
 
#"};
125
 
#    return (deliver);
126
 
#}
 
1
# This is a basic VCL configuration file for varnish.  See the vcl(7)
 
2
# man page for details on VCL syntax and semantics.
 
3
 
4
# Default backend definition.  Set this to point to your content
 
5
# server.
 
6
 
7
# backend default {
 
8
#     .host = "127.0.0.1";
 
9
#     .port = "8080";
 
10
# }
 
11
 
12
# Below is a commented-out copy of the default VCL logic.  If you
 
13
# redefine any of these subroutines, the built-in logic will be
 
14
# appended to your code.
 
15
 
16
# sub vcl_recv {
 
17
#     if (req.http.x-forwarded-for) {
 
18
#       set req.http.X-Forwarded-For =
 
19
#           req.http.X-Forwarded-For ", " client.ip;
 
20
#     } else {
 
21
#       set req.http.X-Forwarded-For = client.ip;
 
22
#     }
 
23
#     if (req.request != "GET" &&
 
24
#       req.request != "HEAD" &&
 
25
#       req.request != "PUT" &&
 
26
#       req.request != "POST" &&
 
27
#       req.request != "TRACE" &&
 
28
#       req.request != "OPTIONS" &&
 
29
#       req.request != "DELETE") {
 
30
#         /* Non-RFC2616 or CONNECT which is weird. */
 
31
#         return (pipe);
 
32
#     }
 
33
#     if (req.request != "GET" && req.request != "HEAD") {
 
34
#         /* We only deal with GET and HEAD by default */
 
35
#         return (pass);
 
36
#     }
 
37
#     if (req.http.Authorization || req.http.Cookie) {
 
38
#         /* Not cacheable by default */
 
39
#         return (pass);
 
40
#     }
 
41
#     return (lookup);
 
42
# }
 
43
 
44
# sub vcl_pipe {
 
45
#     # Note that only the first request to the backend will have
 
46
#     # X-Forwarded-For set.  If you use X-Forwarded-For and want to
 
47
#     # have it set for all requests, make sure to have:
 
48
#     # set req.http.connection = "close";
 
49
#     # here.  It is not set by default as it might break some broken web
 
50
#     # applications, like IIS with NTLM authentication.
 
51
#     return (pipe);
 
52
# }
 
53
 
54
# sub vcl_pass {
 
55
#     return (pass);
 
56
# }
 
57
 
58
# sub vcl_hash {
 
59
#     set req.hash += req.url;
 
60
#     if (req.http.host) {
 
61
#         set req.hash += req.http.host;
 
62
#     } else {
 
63
#         set req.hash += server.ip;
 
64
#     }
 
65
#     return (hash);
 
66
# }
 
67
 
68
# sub vcl_hit {
 
69
#     if (!obj.cacheable) {
 
70
#         return (pass);
 
71
#     }
 
72
#     return (deliver);
 
73
# }
 
74
 
75
# sub vcl_miss {
 
76
#     return (fetch);
 
77
# }
 
78
 
79
# sub vcl_fetch {
 
80
#     if (!beresp.cacheable) {
 
81
#         return (pass);
 
82
#     }
 
83
#     if (beresp.http.Set-Cookie) {
 
84
#         return (pass);
 
85
#     }
 
86
#     return (deliver);
 
87
# }
 
88
 
89
# sub vcl_deliver {
 
90
#     return (deliver);
 
91
# }
 
92
 
93
# sub vcl_error {
 
94
#     set obj.http.Content-Type = "text/html; charset=utf-8";
 
95
#     synthetic {"
 
96
# <?xml version="1.0" encoding="utf-8"?>
 
97
# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 
98
#  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
99
# <html>
 
100
#   <head>
 
101
#     <title>"} obj.status " " obj.response {"</title>
 
102
#   </head>
 
103
#   <body>
 
104
#     <h1>Error "} obj.status " " obj.response {"</h1>
 
105
#     <p>"} obj.response {"</p>
 
106
#     <h3>Guru Meditation:</h3>
 
107
#     <p>XID: "} req.xid {"</p>
 
108
#     <hr>
 
109
#     <address>
 
110
#        <a href="http://www.varnish-cache.org/">Varnish cache server</a>
 
111
#     </address>
 
112
#   </body>
 
113
# </html>
 
114
# "};
 
115
#     return (deliver);
 
116
# }