[master] e995b1a Add short example on how to get Websockets to work

Lasse Karstensen lkarsten at varnish-cache.org
Fri Feb 24 15:12:27 CET 2012


commit e995b1a518b4c6d89424eb8cdc6deb091ea04787
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