[prev in list] [next in list] [prev in thread] [next in thread] 

List:       varnish-commit
Subject:    [master] 95dd0bd41 Improve "None" backend documentation
From:       Nils Goroll <nils.goroll () uplex ! de>
Date:       2020-12-07 16:44:07
Message-ID: 20201207164407.40DDABE5C5 () lists ! varnish-cache ! org
[Download RAW message or body]


commit 95dd0bd413fa2cf42f4af974aa81ac3199b1c83e
Author: Nils Goroll <nils.goroll@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
 -----------------
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic