configuration-templates
/varnish/4/default.vcl |
@@ -62,6 +62,22 @@ |
} |
|
sub vcl_recv { |
### Conditional routing based on host header requests with subdomain support - split domain. |
## Suppose that you have multiple backends (configured at the top of this file) that route to |
## diferent backends that also have different websites. |
## In that scenario you would want to, say: |
## * route example1.tld or www.example1.tld to the server1 (192.168.0.10) backend |
## * route example2.tld or www.example2.tld to the server2 (192.168.0.20) backend |
## |
#if (req.http.host ~ "^(.*\.)?example1\.com$") { |
# set req.backend_hint = server1; |
# return (hash); |
#} |
#if (req.http.host ~ "^(.*\.)?example2\.com$") { |
# set req.backend_hint = server2; |
# return (hash); |
#} |
|
# Called at the beginning of a request, after the complete request has been received and parsed. |
# Its purpose is to decide whether or not to serve the request, how to do it, and, if applicable, |
# which backend to use. |