[3.0] fdd168f Add short example on how to get Websockets to work

Tollef Fog Heen tfheen at varnish-cache.org
Thu May 24 14:51:10 CEST 2012


commit fdd168f95e2bfa0ae2d6aebaec2124b4cb856f6c
Author: Lasse Karstensen <lasse at varnish-software.com>
Date:   Fri Feb 24 15:12:44 2012 +0100

    Add short example on how to get Websockets to work

diff --git a/doc/sphinx/tutorial/websockets.rst b/doc/sphinx/tutorial/websockets.rst
new file mode 100644
index 0000000..a74353e
--- /dev/null
+++ b/doc/sphinx/tutorial/websockets.rst
@@ -0,0 +1,20 @@
+
+Using Websockets 
+----------------
+
+Websockets is a technology for creating a bidirectional stream-based channel over HTTP.
+
+To run websockets through Varnish you need to pipe it, and copy the Upgrade header. Use the following
+VCL config to do so::
+
+    sub vcl_pipe {
+         if (req.http.upgrade) {
+             set bereq.http.upgrade = req.http.upgrade;
+         }
+    }
+    sub vcl_recv {
+         if (req.http.Upgrade ~ "(?i)websocket") {
+             return (pipe);
+         }
+    }
+



More information about the varnish-commit mailing list