<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.apple-tab-span
        {mso-style-name:apple-tab-span;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="2050" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<span class="ubtech-campaign-659211d3-a08f-4e8a-940d-6eaba6aaaa6f"> </span><br>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks 
</span><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">Carlos , <o:p>
</o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">That solved the issue.</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" dir="RTL" style="text-align:right;direction:rtl;unicode-bidi:embed">
<span dir="LTR" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><img width="623" height="74" id="Picture_x0020_1" src="cid:image001.jpg@01CFBDF6.735860D0" alt="yariv_sig_outlook"><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Carlos Abalde [mailto:carlos.abalde@gmail.com]
<br>
<b>Sent:</b> Friday, August 22, 2014 10:28 AM<br>
<b>To:</b> <span lang="HE" dir="RTL">יריב הראל</span><br>
<b>Cc:</b> varnish-misc@varnish-cache.org<br>
<b>Subject:</b> Re: changing backend and host header not working<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">On 22 Aug 2014, at 09:18, <span lang="HE" dir="RTL">יריב הראל
</span><span dir="LTR"></span><span dir="LTR"></span><span dir="LTR"></span><span dir="LTR"></span><<a href="mailto:YARIV-H@yit.co.il">YARIV-H@yit.co.il</a>> wrote:<o:p></o:p></p>
<div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Selecting backend and normalizing host header :<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">sub vcl_recv {<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">        if (req.http.host == "<a href="http://source-qa.example.co.il/"><span style="color:purple">source-qa.example.co.il</span></a>" || "<a href="http://source-qa-pp.example.co.il/"><span style="color:purple">source-qa-pp.example.co.il</span></a>"
 || "<a href="http://qa.example.co.il/"><span style="color:purple">qa.example.co.il</span></a>") {<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">                set req.http.host = "<a href="http://qa.example.co.il/"><span style="color:purple">qa.example.co.il</span></a>";<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">                set req.backend = example_qa;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">}<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">}<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">sub vcl_recv {<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">                if (req.http.host == "<a href="http://source-qa-test.co.il/"><span style="color:purple">source-qa-test.co.il</span></a>" || "<a href="http://qa-test.co.il/"><span style="color:purple">qa-test.co.il</span></a>"
 ) {<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">                                set req.http.host = "<a href="http://qa-test.ynet.co.il/"><span style="color:purple">qa-test.ynet.co.il</span></a>";<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">                                set req.backend = test_other_sites_qa;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">}<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">}<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Now the problem is that  when I send a request with one of the host headers  "<a href="http://source-qa.example.co.il/"><span style="color:purple">source-qa.example.co.il</span></a>"
 || "<a href="http://source-qa-pp.example.co.il/"><span style="color:purple">source-qa-pp.example.co.il</span></a>" || "<a href="http://qa.example.co.il/"><span style="color:purple">qa.example.co.il</span></a>"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">The request is always sent to  test_other_sites_qa which is the second backend and not the correct one .<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Hi,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">It seems the second vcl_recv subroutine is matching for every request. You should write:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span class="apple-tab-span">            </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">if (req.http.host == "</span><a href="http://source-qa.example.co.il/"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:purple">source-qa.example.co.il</span></a><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">"
 || </span><span style="font-size:11.5pt;font-family:"Calibri","sans-serif"">req.http.host == </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">"</span><a href="http://source-qa-pp.example.co.il/"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:purple">source-qa-pp.example.co.il</span></a><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">"
 || </span><span style="font-size:11.5pt;font-family:"Calibri","sans-serif"">req.http.host == </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">"</span><a href="http://qa.example.co.il/"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:purple">qa.example.co.il</span></a><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">")
 {</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span class="apple-tab-span"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">                               
</span></span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">...</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span class="apple-tab-span">            </span>if <span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">(req.http.host == "</span><a href="http://source-qa-test.co.il/"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:purple">source-qa-test.co.il</span></a><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">"
 || </span><span style="font-size:11.5pt;font-family:"Calibri","sans-serif"">req.http.host = </span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">"</span><a href="http://qa-test.co.il/"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:purple">qa-test.co.il</span></a><span style="font-size:11.5pt;font-family:"Calibri","sans-serif"">”</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> )
 {</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span class="apple-tab-span"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">                               
</span></span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">...</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">—<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Carlos Abalde.<o:p></o:p></p>
</div>
</div>
<table style="width:100%;border:none;">
<tbody>
<tr>
<td style="width:30%; text-align:left;"></td>
<td style="width:40%; text-align:center;">
<div style="text-align:center;"><a href="http://my.ynet.co.il/short/content/2013/ynetnewsletter/index_2.aspx" target="_blank"><img src="cid:Banner1-d236.jpg" style="border:none;" alt="Banner"></a><br>
<a href="http://www.u-btech.com/products/xtrabanner/poweredby" target="_blank" style="color:#98989b;font-family:Arial;font-size:10px;letter-spacing:1px;text-decoration:none;"><span style="white-space:nowrap;">Powered by</span>
<span style="white-space:nowrap;">U‑BTech</span> <span style="white-space:nowrap;">
<span style="color:#b3d236; font-weight:bold;">XTRA</span>BANNER</span></a><br>
</div>
</td>
<td style="width:30%; text-align:right;"></td>
</tr>
</tbody>
</table>
</body>
</html>