[master] 95dd0bd41 Improve "None" backend documentation
Nils Goroll
nils.goroll at uplex.de
Mon Dec 7 16:44:07 UTC 2020
commit 95dd0bd413fa2cf42f4af974aa81ac3199b1c83e
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Mon Dec 7 17:39:00 2020 +0100
Improve "None" backend documentation
Fixes #3478
diff --git a/doc/sphinx/users-guide/vcl-backends.rst b/doc/sphinx/users-guide/vcl-backends.rst
index 5a640712f..311c6fd02 100644
--- a/doc/sphinx/users-guide/vcl-backends.rst
+++ b/doc/sphinx/users-guide/vcl-backends.rst
@@ -31,9 +31,41 @@ Varnish can have several backends defined you can even join
several backends together into clusters of backends for load balancing
purposes.
-backends can also be empty or 'none' with the following syntax.::
+The "None" backend
+------------------
+
+Backends can also be declared as ``None`` with the following syntax:::
+
+ backend default None;
+
+``None`` backends are special:
+
+* All backends declared ``None`` compare equal::
+
+ backend a None;
+ backend b None;
- backend default none;
+ sub vcl_recv {
+ set req.backend_hint = a;
+ if (req.backend_hint == b) {
+ return (synth(200, "this is true"));
+ }
+ }
+
+* The ``None`` backend evaluates to ``false`` when used in a boolean
+ context::
+
+ backend nil None;
+
+ sub vcl_recv {
+ set req.backend_hint = nil;
+ if (! req.backend_hint) {
+ return (synth(200, "We get here"));
+ }
+ }
+
+* When directors find no healthy backend, they typically return the
+ ``None`` backend
Multiple backends
-----------------
More information about the varnish-commit
mailing list