Skip to content

Node.js based forum software built for the modern web

ported varnish docs

psychobunnyee63ecbe3e9e
diff --git a/docs/configuring/proxies/varnish.rst b/docs/configuring/proxies/varnish.rst
index 1b37712db5..2c78e55df9 100644
--- a/docs/configuring/proxies/varnish.rst
+++ b/docs/configuring/proxies/varnish.rst
@@ -1,34 +1,37 @@
-To be sure Varnish will work properly with NodeBB check that your configuration ```/etc/varnish/default.vcl``` is optimized for **websockets**.
+Configuring Varnish Cache
+==========================
-```varnish
-backend nodebb {
- .host = "127.0.0.1"; # your nodebb host
- .port = "4567"; # your nodebb port
-}
+To be sure Varnish will work properly with NodeBB check that your configuration ``/etc/varnish/default.vcl`` is optimized for **websockets**.
-sub vcl_recv {
+.. code::
- # Pipe websocket connections directly to Node.js
- if (req.http.Upgrade ~ "(?i)websocket") {
- set req.backend = nodebb;
- return (pipe);
+ backend nodebb {
+ .host = "127.0.0.1"; # your nodebb host
+ .port = "4567"; # your nodebb port
}
- # NodeBB
- if (req.http.host == "forum.yourwebsite.com") { # change this to match your host
- if (req.url ~ "^/socket.io/") {
- set req.backend = nodebb;
- return (pipe); # return pass seems not working for websockets
+ sub vcl_recv {
+
+ # Pipe websocket connections directly to Node.js
+ if (req.http.Upgrade ~ "(?i)websocket") {
+ set req.backend = nodebb;
+ return (pipe);
}
- return (pass); # don't cache
- }
-}
+ # NodeBB
+ if (req.http.host == "forum.yourwebsite.com") { # change this to match your host
+ if (req.url ~ "^/socket.io/") {
+ set req.backend = nodebb;
+ return (pipe); # return pass seems not working for websockets
+ }
+ return (pass); # don't cache
+ }
-sub vcl_pipe {
- # Need to copy the upgrade header
- if (req.http.upgrade) {
- set bereq.http.upgrade = req.http.upgrade;
}
-}
-```
\ No newline at end of file
+
+ sub vcl_pipe {
+ # Need to copy the upgrade header
+ if (req.http.upgrade) {
+ set bereq.http.upgrade = req.http.upgrade;
+ }
+ }
\ No newline at end of file