[master] a4d1d5d Small example on how to do synthetic responses

Lasse Karstensen lkarsten at varnish-software.com
Mon Mar 17 14:19:51 CET 2014


commit a4d1d5d2ad8dd3d9a1c585e1d5e009bb81352944
Author: Lasse Karstensen <lkarsten at varnish-software.com>
Date:   Mon Mar 17 14:19:46 2014 +0100

    Small example on how to do synthetic responses

diff --git a/doc/sphinx/whats-new/upgrading.rst b/doc/sphinx/whats-new/upgrading.rst
index 68a41d0..a0da998 100644
--- a/doc/sphinx/whats-new/upgrading.rst
+++ b/doc/sphinx/whats-new/upgrading.rst
@@ -41,6 +41,24 @@ You must now explicitly return an error::
 
 	return(error(999, "Response));
 
+
+Synthetic responses in vcl_error
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Setting headers on synthetic response bodies made in vcl_error are now done on
+resp.http instead of obj.http.
+
+The synthetic keyword is now a function::
+
+    if (resp.status == 799) {
+        set resp.status = 200;
+        set resp.http.Content-Type = "text/plain; charset=utf-8";
+        synthetic({"You are "} + client.ip);
+        return (deliver);
+    }
+
+
+
 hit_for_pass objects are created using beresp.uncacheable
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Example::



More information about the varnish-commit mailing list