I started setting up a reversed proxy server with varnish. I'm not experienced setting up varnish.
I am trying to use url of the backend instead of ip address with no luck:
1- Approach a:
backend default {
.host = "www.backend.mysite.com";
.port = "80";
}
Issue a: Restarting varnish keeps failing.
2- Approach b:
sub vcl_recv {
set req.http.Host = "www.backend.mysite.com";
...
}
Issue b: with this approach, when I enter mysite.com in browser bar, it gets redirected to www.backend.mysite.com.
I don't think this is an accepted behavior for this rule. Correct me if I am wrong.
Thanks, Shab
your first try should work but your varnish server needs to have access to internet or at least to dns servers.
when you start varnish it will make a dns lookup and replace www.backend.mysite.com by the first ip it is given by dns.