Created
January 19, 2013 14:36
-
-
Save bsphere/4572994 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backend nginx { | |
.host = "127.0.0.1"; | |
.port = "8080"; | |
} | |
backend node1 { | |
.host = "127.0.0.1"; | |
.port = "3000"; | |
} | |
backend node2 { | |
.host = "127.0.0.1"; | |
.port = "3001"; | |
} | |
sub vcl_recv { | |
if (req.http.Upgrade ~ "(?i)websocket") { | |
if (req.http.host ~ "domain1.com") { | |
set req.backend = node1; | |
} else if (req.http.host ~ "domain2.com") { | |
set req.backend = node2; | |
} | |
return(pipe); | |
} else { | |
set req.backend = nginx; | |
} | |
} | |
sub vcl_pipe { | |
if (req.http.upgrade) { | |
set bereq.http.upgrade = req.http.upgrade; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment