ported varnish docs

v1.18.x
psychobunny 11 years ago
parent 7ac3f82c5e
commit ee63ecbe3e

@ -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 To be sure Varnish will work properly with NodeBB check that your configuration ``/etc/varnish/default.vcl`` is optimized for **websockets**.
backend nodebb {
.host = "127.0.0.1"; # your nodebb host
.port = "4567"; # your nodebb port
}
sub vcl_recv { .. code::
# Pipe websocket connections directly to Node.js backend nodebb {
if (req.http.Upgrade ~ "(?i)websocket") { .host = "127.0.0.1"; # your nodebb host
set req.backend = nodebb; .port = "4567"; # your nodebb port
return (pipe);
} }
# NodeBB sub vcl_recv {
if (req.http.host == "forum.yourwebsite.com") { # change this to match your host
if (req.url ~ "^/socket.io/") { # Pipe websocket connections directly to Node.js
set req.backend = nodebb; if (req.http.Upgrade ~ "(?i)websocket") {
return (pipe); # return pass seems not working for websockets set req.backend = nodebb;
return (pipe);
}
# 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
} }
return (pass); # don't cache
}
} }
sub vcl_pipe { sub vcl_pipe {
# Need to copy the upgrade header # Need to copy the upgrade header
if (req.http.upgrade) { if (req.http.upgrade) {
set bereq.http.upgrade = req.http.upgrade; set bereq.http.upgrade = req.http.upgrade;
}
} }
}
```
Loading…
Cancel
Save