Thanks  Carlos ,

That solved the issue.

[yariv_sig_outlook]

From: Carlos Abalde [mailto:[email protected]]
Sent: Friday, August 22, 2014 10:28 AM
To: יריב הראל
Cc: [email protected]
Subject: Re: changing backend and host header not working

On 22 Aug 2014, at 09:18, יריב הראל 
<[email protected]<mailto:[email protected]>> wrote:


Selecting backend and normalizing host header :

sub vcl_recv {
        if (req.http.host == 
"source-qa.example.co.il<http://source-qa.example.co.il/>" || 
"source-qa-pp.example.co.il<http://source-qa-pp.example.co.il/>" || 
"qa.example.co.il<http://qa.example.co.il/>") {
                set req.http.host = 
"qa.example.co.il<http://qa.example.co.il/>";
                set req.backend = example_qa;
}
}

sub vcl_recv {
                if (req.http.host == 
"source-qa-test.co.il<http://source-qa-test.co.il/>" || 
"qa-test.co.il<http://qa-test.co.il/>" ) {
                                set req.http.host = 
"qa-test.ynet.co.il<http://qa-test.ynet.co.il/>";
                                set req.backend = test_other_sites_qa;
}
}

Now the problem is that  when I send a request with one of the host headers  
"source-qa.example.co.il<http://source-qa.example.co.il/>" || 
"source-qa-pp.example.co.il<http://source-qa-pp.example.co.il/>" || 
"qa.example.co.il<http://qa.example.co.il/>"

The request is always sent to  test_other_sites_qa which is the second backend 
and not the correct one .

Hi,

It seems the second vcl_recv subroutine is matching for every request. You 
should write:

            if (req.http.host == 
"source-qa.example.co.il<http://source-qa.example.co.il/>" || req.http.host == 
"source-qa-pp.example.co.il<http://source-qa-pp.example.co.il/>" || 
req.http.host == "qa.example.co.il<http://qa.example.co.il/>") {
                                ...

            if (req.http.host == 
"source-qa-test.co.il<http://source-qa-test.co.il/>" || req.http.host = 
"qa-test.co.il<http://qa-test.co.il/>” ) {
                                ...

Cheers,

—
Carlos Abalde.

[Banner]<http://my.ynet.co.il/short/content/2013/ynetnewsletter/index_2.aspx>
Powered by U‑BTech 
XTRABANNER<http://www.u-btech.com/products/xtrabanner/poweredby>

_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to