実際、私のセットアップはこんな感じです。
cluster.com - 192.168.0.200 (varnish/port 80)
example.com - 192.168.0.100 (apache,namebased vhost/8080 - backendname - website)
yyy.com - 192.168.0.100 (apache,namebased vhost/8080 -backendname - api)
cluster.com is the varnish server and front-end connections coming to this and rewrite to other defined back-ends (round-robin based balancing)
backend website {
.host = "example.com";
.port = "8080";
}
backend api {
.host = "yyy.com";
.port = "8080";
}
director clust round-robin {
{ .backend = api; }
{ .backend = website; }
}
sub vcl_recv {
set req.backend = clust;
if (req.request)
{
return(pass);
}
}
when i hit the cluster.com , it is always going to example.com, but what i need to do is first request go to example.com second request yyy.com and so on...when i add another server (different host/different IP say 192.168.0.111/zzz.com, and a different backend) , it goes like this
first request - example.com
second request - examplee.com
third request - zzz.com
but i can change the default behavior by setting up set req.host = yyy.com and then it will goes to
first request - yyy.com
second request - yyy.com
third request - zzz.com
これは、正しいバックエンドへのホスト ヘッダー転送と関係があります。その機能を vcl_recv に追加するにはどうすればよいですか? これについての助けに感謝します。これは他のサーバーで完全に機能しています(名前ベースの仮想ホストではなく、異なるサーバー)