Skip to content

Instantly share code, notes, and snippets.

@jamesmartin
Last active February 3, 2019 12:54
Show Gist options
  • Select an option

  • Save jamesmartin/84f71eaef935ed76e4b8 to your computer and use it in GitHub Desktop.

Select an option

Save jamesmartin/84f71eaef935ed76e4b8 to your computer and use it in GitHub Desktop.
Varnish: Route requests to subdomains based on URL
backend insights {
.host = "insights.example.com"
.port = "3000";
}
backend help {
.host = "help.example.com"
.port = "80";
}
backend blog {
.host = "blog.example.com"
.port = "8080";
}
sub vcl_recv {
if (req.url ~ "insights") {
set req.backend = insights;
}
if (req.url ~ "help") {
set req.backend = help;
}
if (req.url ~ "blog") {
set req.backend = blog;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment