configuration - Configure multiple sites with Varnish -


we have server needs serve multiple domains though varnish e.g. example1.com, example2.com , example3.com

our current .vcl file looks this:

sub vcl_recv {   set req.http.host = "example1.com";       lookup; } 

how set correct req.http.host correct incoming request?

you can support multiple frontend domains way:

 backend example1 {      .host = "backend.example1.com";      .port = "8080";  }  backend example2 {       .host = "backend.example2.com";       .port = "8080";  }  sub vcl_recv {     if (req.http.host == "example1.com") {         #you need following line if backend has multiple virtual host names         set req.http.host = "backend.example1.com";         set req.backend = example1;         return (lookup);     }     if (req.http.host == "example2.com") {         #you need following line if backend has multiple virtual host names         set req.http.host = "backend.example2.com";         set req.backend = example2;         return (lookup);     }  } 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -