From 4d487b2809367132be159f8b3e20ec4b8c2c159b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Vel=C3=A1zquez?= Date: Tue, 15 Mar 2016 18:03:04 +0100 Subject: [PATCH] synth improvement --- .aspell.en.pws | 34 +++++++++++++++++++--------------- varnish_book.rst | 21 ++++++++++++--------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/.aspell.en.pws b/.aspell.en.pws index 6d9592d..f515f5f 100644 --- a/.aspell.en.pws +++ b/.aspell.en.pws @@ -1,4 +1,4 @@ -personal_ws-1.1 en 448 +personal_ws-1.1 en 451 ajax apache google @@ -7,6 +7,7 @@ netstat multi Magnus ReqMethod +httpd CDN undef API @@ -16,8 +17,8 @@ CET github delim arg -https HTTP's +https VMODs Naghibi nosni @@ -52,8 +53,8 @@ RespProtocol CType SHared Henning -CSS DNS +CSS csv compressions gcc @@ -96,13 +97,14 @@ subrequests HMAC strcmp README -httpie HTTPie +httpie varnishtop urlencoded regex VaRY HLS +functionalities instantiation IETF maxage @@ -116,6 +118,7 @@ objectcore Makefile nlpt param +apachectl Blix XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX IRC @@ -127,8 +130,8 @@ cliok sudo txreq RESTful -IPv ipv +IPv Argv uint Acceptor @@ -144,8 +147,8 @@ clierr LFU metadata saintmode -FreeBSD freebsd +FreeBSD gunzip linux Economization @@ -157,12 +160,12 @@ Aondio enmod mgt releasever -respstatus RespStatus +respstatus vmodtool getNonMasqueraded -HashTwo hashtwo +HashTwo tIncluded DDoS workspace @@ -176,8 +179,8 @@ SimpleHTTPServer Kamp codename LRU -ReqURL ReqUrl +ReqURL asts SELinux LTS @@ -261,19 +264,19 @@ helloworldtest varnishapi ubuntu Footbar -rst VBE +rst VCA -src vcc +src recv subrequest util SQL VDD VBP -vcl VAV +vcl VXIDs TLS setsebool @@ -297,8 +300,8 @@ requesters Rubén Webdev systemctl -VIN JPEG +VIN ttl rxreq rxres @@ -311,8 +314,8 @@ url testbed hdrbytes Arianna -VLU utf +VLU BereqURL malloc dotMobi's @@ -424,6 +427,7 @@ xb VM Hagander ETags +CentOS ws TOUPDATE Fialka @@ -433,8 +437,8 @@ localhost vstatdprobe Karstensen varnishlog -ETag Etag +ETag substring noverify AUTOEXTEND diff --git a/varnish_book.rst b/varnish_book.rst index d493b5a..1f09bf4 100644 --- a/varnish_book.rst +++ b/varnish_book.rst @@ -4447,9 +4447,11 @@ VCL – ``vcl_deliver`` VCL – ``vcl_synth`` ------------------- -- Used to generate content from within Varnish, without talking to the backend -- Error messages go here by default -- Other use cases: Redirecting users (301/302 redirects) +- Used to generate content within Varnish +- Error messages can be created here +- Other use cases: redirecting users (301/302 redirects) + +**vcl/default-vcl_synth.vcl**: .. include:: vcl/default-vcl_synth.vcl :literal: @@ -4458,22 +4460,23 @@ VCL – ``vcl_synth`` .. container:: handout - To make a distinction between VCL synthetic responses and internally generated errors (when trying to fetch an object), there are two subroutines that handle errors in Varnish. - One is ``vcl_synth``, and the other is ``vcl_backend_error``. - To return control to ``vcl_synth``,call the ``synth()`` function like this:: + You can create synthetic responses, e.g., personalized error messages, in ``vcl_synth``. + To call this subroutine you do:: return (synth(status_code, "reason")); - Note that the syntax ``synth`` is not a keyword, but a function with arguments. + Note that ``synth`` is not a keyword, but a function with arguments. You must explicitly return the ``status code`` and ``reason`` arguments for ``vcl_synth``. Setting headers on synthetic response bodies are done on ``resp.http``. .. note:: - Note how you can use ``{"`` and ``"}`` to make multi-line strings. - This is not limited to the ``synthetic()`` function, but can be used anywhere. + + From ``vcl/default-vcl_synth.vcl``, note that ``{"`` and ``"}`` can be used to make multi-line strings. + This is not limited to the ``synthetic()`` function, but one can be used anywhere. .. note:: + A ``vcl_synth`` defined object is never stored in cache, contrary to a ``vcl_backend_error`` defined object, which may end up in cache. ``vcl_synth`` and ``vcl_backend_error`` replace ``vcl_error`` from Varnish 3.