1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
Upgrading from Varnish 2.1 to 3.0
3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
This is a compilation of items you need to pay attention to when upgrading from Varnish 2.1 to 3.0
10
In most cases you need to update your VCL since there has been some changes to the syntax.
12
string concatenation operator
13
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14
String concatenation did not have an operator previously, but this has now been changed to ``+``.
16
no more %-escapes in strings
17
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18
To simplify strings, the %-encoding has been removed. If you need non-printable characters, you need to use inline C.
20
``log`` moved to the std vmod
21
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23
``log`` has moved to the std vmod::
30
std.log("log something");
32
You only need to import std once.
34
purges are now called bans
35
~~~~~~~~~~~~~~~~~~~~~~~~~~
37
``purge()`` and ``purge_url()`` are now respectively ``ban()`` and ``ban_url()``, so you should replace all occurences::
39
purge("req.url = " req.url);
43
ban("req.url = " + req.url);
45
``purge`` does not take any arguments anymore, but can be used in vcl_hit or vcl_miss to purge the item from the cache, where you would reduce ttl to 0 in Varnish 2.1::
48
if (req.request == "PURGE") {
57
if (req.request == "PURGE") {
63
``beresp.cacheable`` is gone
64
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66
``beresp.cacheable`` is gone, and can be replaced with ``beresp.ttl > 0s``
68
returns are now done with the ``return()`` function
69
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71
``pass``, ``pipe``, ``lookup``, ``deliver``, ``fetch``, ``hash``, ``pipe`` and ``restart`` are no longer keywords, but arguments to ``return()``, so::
84
``req.hash`` is replaced with ``hash_data()``
85
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
87
You no longer append to the hash with ``+=``, so::
89
set req.hash += req.url;
95
``esi`` is replaced with ``beresp.do_esi``
96
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98
You no longer enable ESI with ``esi``, so::
102
in ``vcl_fetch`` becomes::
104
set beresp.do_esi = true;
106
``pass`` in ``vcl_fetch`` renamed to ``hit_for_pass``
107
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
109
The difference in behaviour of ``pass`` in ``vcl_recv`` and
110
``vcl_fetch`` confused people, so to make it clearer that they are
111
different, you must now do ``return(hit_for_pass)`` when doing a pass
118
Varnish will return an error when headers are too large instead of just ignoring them. If the limits are too low, Varnish will return HTTP 413. You can change the limits by increasing http_req_hdr_len and http_req_size.
120
thread_pool_max is now per thread pool, while it was a total across all pools in 2.1. If you had this set in 2.1, you should adjust it for 3.0.