Doc: Upgrading to 3.0

Andreas Plesner Jacobsen apj at mutt.dk
Thu Aug 4 23:17:36 CEST 2011


Based on questions in the IRC channel, I've compiled a small list of changes to
make it easier to upgrade from 2.1 to 3.0 with the hope that they can be
included in the docs. rst is attached.

I'm sure more gotchas can be added as more people start using 3.0

-- 
Andreas
-------------- next part --------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Upgrading from Varnish 2.1 to 3.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This is a compilation of items you need to pay attention to when upgrading from Varnish 2.1 to 3.0

Changes to VCL
==============

In most cases you need to update your VCL since there has been some changes to the syntax.

String concatenation did not have an operator previously, but this has now been changed to ``+``.

``log`` has moved to the std vmod:

	log "log something";

becomes

	import std;
	std.log "log something";

You only need to import std once.

``purge()`` and ``purge_url()`` are now respectively ``ban()`` and ``ban_url()``, so you should replace all occurences:

	purge("req.url = " req.url);

becomes

	ban("req.url = " + req.url);

``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.

	sub vcl_hit {
	  if (req.request == "PURGE") {
	    set obj.ttl = 0s;
	    error 200 "Purged.";
	  }
	}

becomes

	sub vcl_hit {
	  if (req.request == "PURGE") {
	    purge;
	    error 200 "Purged.";
	  }
	}

``beresp.cacheable`` is gone, and can be replaced with ``beresp.ttl > 0``

``pass``, ``pipe``, ``lookup``, ``deliver``, ``fetch``, ``hash``, ``pipe`` and ``restart`` are no longer keywords, but arguments to ``return()``, so

	sub vcl_pass {
	  pass;
	}

becomes

	sub vcl_pass {
	  return(pass);
	}

You no longer append to the hash with +=, so

	set req.hash += req.url;

becomes

	hash_data(req.url);

Changes to behaviour
====================

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.


More information about the varnish-dev mailing list